File indexing completed on 2025-04-01 08:52:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #define KUIP_VERSION 950303
0034
0035
0036
0037 #if defined(CERNLIB_AIX370)
0038 #include "khaix370.h"
0039 #endif
0040 #if defined(CERNLIB_APOFTN)
0041 #include "khapoftn.h"
0042 #endif
0043 #if defined(CERNLIB_IBMVM)
0044 #include "khibmvm.h"
0045 #endif
0046 #if defined(CERNLIB_IBMMVS)
0047 #include "khibmmvs.h"
0048 #endif
0049 #if defined(CERNLIB_NEWLIB)
0050 #include "khnewlib.h"
0051 #endif
0052
0053
0054 #ifdef AIX370
0055 # define MACHINE_NAME "IBMAIX"
0056 # define UNIX
0057 # define F77_EXTERN_INDIRECT
0058 #endif
0059
0060
0061 #if defined(apollo) || defined(__apollo)
0062 # define MACHINE_NAME "APOLLO"
0063 # define APOLLO
0064 # define UNIX
0065 # include <apollo/base.h>
0066 # include <apollo/error.h>
0067 # include <apollo/ios.h>
0068 # include <apollo/pad.h>
0069 # include <apollo/pgm.h>
0070 # include <apollo/streams.h>
0071 # ifdef APOLLO_FTN
0072 # define F77_CHAR_LEN_IND
0073 # define F77_CHAR_LEN_TYPE short
0074 # define F77_EXTERN_LOWERCASE
0075 # endif
0076 # define F77_EXTERN_INDIRECT
0077 # define F77_COMMON(name) name __attribute((__section(name)))
0078 # ifndef EXTERN
0079 # define EXTERN
0080 # endif
0081 # define FATAL_SIGFPE
0082 # define HAVE_MEMMOVE
0083 # define HAVE_STRCASECMP
0084 # define NO_DIRENT_H
0085 # define TERMIO_BSD
0086 #endif
0087
0088
0089 #if defined(__convexc__)
0090 # define CONVEX
0091 # define MACHINE_NAME "CONVEX"
0092 # define UNIX
0093 # define F77_BLOCK(name,NAME) _##name##_
0094 # define F77_ARG_CONSTANT
0095 # ifndef EXTERN
0096 # define EXTERN
0097 # endif
0098 # define FATAL_SIGFPE
0099 # define HAVE_MEMMOVE
0100 # define HAVE_STRCASECMP
0101 # define HAVE_SELECT
0102 # define HAVE_VFORK
0103 # define MATCH_RE_COMP
0104 # define TERMIO_MAP_NL
0105 # define USE_EDIT_SERVER
0106 #endif
0107
0108
0109 #ifdef CRAY
0110 # define MACHINE_NAME "CRAY"
0111 # define UNIX
0112 # include <fortran.h>
0113 # define F77_EXTERN_UPPERCASE
0114 # ifndef EXTERN
0115 # define EXTERN
0116 # endif
0117 # define HAVE_STRCASECMP
0118 # define NO_EDIT_SERVER
0119 #endif
0120
0121
0122 #if defined(__hpux)
0123 # define MACHINE_NAME "HPUX"
0124 # define HPUX
0125 # define UNIX
0126 # ifndef _HPUX_SOURCE
0127 # define _HPUX_SOURCE
0128 # endif
0129 # define FATAL_SIGFPE
0130 # define HAVE_MEMMOVE
0131 # define HAVE_STRCASECMP
0132 # define HAVE_STRRSTR
0133 # define HAVE_SELECT
0134 # define SELECT_CAST(fds) (int*)fds
0135 #endif
0136
0137
0138 #ifdef _IBMR2
0139 # define IBMRT
0140 # define MACHINE_NAME "IBMRT"
0141 # define UNIX
0142 # define HAVE_MEMMOVE
0143 # define HAVE_STRCASECMP
0144 # include <sys/select.h>
0145 # define HAVE_SELECT
0146 # define BROKEN_F77_IO
0147 #endif
0148
0149
0150 #ifdef IBMVM
0151 # define ARG_STYLE_CMS
0152 # define MACHINE_NAME "IBM"
0153 # define OS_NAME "VM"
0154 # ifndef IBM370
0155 # define IBM370
0156 # endif
0157 # define KmTimeStamp TimeStamp
0158 typedef char TimeStamp[24];
0159 extern int get_stamp(char*,TimeStamp*);
0160 # define same_stamp(stamp1,stamp2) (strcmp(*(stamp1),*(stamp2)) == 0)
0161 #endif
0162
0163 #ifdef IBMMVS
0164 # define MACHINE_NAME "IBMMVS"
0165 # define OS_NAME "MVS"
0166 # ifndef IBM370
0167 # define IBM370
0168 # endif
0169 #endif
0170
0171 #ifdef IBM370
0172 # define F77_ARG_CONSTANT
0173 # define F77_CHAR_LEN_IND
0174
0175 # define F77_XXXX_ARG_LEN(x) F77_CHAR_ARG_LEN(x)
0176 # define F77_EXTERN_INDIRECT
0177 # define F77_EXTERN_UPPERCASE
0178 # define NO_FCNTL_H
0179 # define NO_UNISTD_H
0180 # define SIGNAL_V7
0181 # define ALLOC_MIN_BYTES 128
0182 # define STUPID_MALLOC
0183 #endif
0184
0185
0186 #ifdef linux
0187 #ifndef LINUX
0188 # define LINUX
0189 #endif
0190 # define MACHINE_NAME "LINUX"
0191 # define UNIX
0192 # define HAVE_MEMMOVE
0193 # define HAVE_STRCASECMP
0194 # define HAVE_SELECT
0195 # define MATCH_RE_COMP
0196 #endif
0197
0198
0199 #ifdef CERNLIB_MACOSX
0200 # define MACOSX
0201 # define MACHINE_NAME "MACOSX"
0202 # define UNIX
0203 # define HAVE_MEMMOVE
0204 # define HAVE_STRCASECMP
0205 # define HAVE_SELECT
0206 #endif
0207
0208
0209 #ifdef MSDOS
0210 # define MACHINE_NAME "IBMPC"
0211 # define OS_NAME "MSDOS"
0212 # define UNIX
0213 # define NO_EDIT_SERVER
0214 # define NO_SOCKET_H
0215 # define NO_SYS_TIME_H
0216 # define SIGNAL_V7
0217 # define SLASHES "\\/"
0218 # define TERMIO_MAP_NL
0219 #endif
0220
0221
0222 #if defined(WIN32) || defined(CERNLIB_WINNT)
0223 # define WINNT
0224 # ifdef _ALPHA_
0225 # define MACHINE_NAME "ALPHA"
0226 # else
0227 # define MACHINE_NAME "Intel"
0228 # endif
0229 # define OS_NAME "Windows"
0230 # define UNIX
0231 # define MSDOS
0232
0233 # ifdef __STDC__
0234 # undef __STDC__
0235 # endif
0236
0237 # include <io.h>
0238 # include <process.h>
0239 # include <direct.h>
0240 # include <windows.h>
0241 # define text_mode__()
0242 # define NO_EDIT_SERVER
0243
0244 # define NO_SYS_TIME_H
0245 # define NO_UNISTD_H
0246 # define HAVE_STAT_H
0247 # define SIGNAL_V7
0248 # define SLASHES "\\/"
0249 # define TERMIO_MAP_NL
0250 # define HAVE_MEMMOVE
0251 # ifdef CERNLIB_MSSTDCALL
0252 # define F77_EXTERN_UPPERCASE
0253 # else
0254 # define F77_EXTERN_LOWERCASE
0255 # endif
0256 #endif
0257
0258
0259 #ifdef NeXT
0260 # define MACHINE_NAME "NEXT"
0261 # define UNIX
0262 # define getcwd(path,maxlen) getwd(path)
0263 # define F77_BLOCK(lc,uc) lc
0264 # define F77_EXTERN_INDIRECT
0265
0266 # define F77_XXXX_ARG_LEN(x) F77_CHAR_ARG_LEN(x)
0267 # define F77_XXXX_USE_LEN(x) ,286716
0268 # define HAVE_MEMMOVE
0269 # define HAVE_VFORK
0270 # define MATCH_RE_COMP
0271 # define NO_DIRENT_H
0272 # define NO_UNISTD_H
0273 # define SIGNAL_BSD
0274 # define TERMIO_BSD
0275 # define GETPGRP_BSD
0276 #endif
0277
0278
0279 #ifdef __osf__
0280 # define UNIX
0281 # ifdef __alpha
0282 # define ALPHA
0283 # define MACHINE_NAME "ALPHA"
0284 # endif
0285 # define HAVE_MEMMOVE
0286 # define HAVE_STRCASECMP
0287 # define HAVE_SELECT
0288 # define BROKEN_F77_IO
0289 #endif
0290
0291
0292 #if defined(__sgi)
0293 # define MACHINE_NAME "SGI"
0294 # define SGI
0295 # define UNIX
0296 # define HAVE_MEMMOVE
0297 # define HAVE_STRCASECMP
0298 # define HAVE_SELECT
0299 #endif
0300
0301
0302 #if defined(sun) || defined(__sun)
0303 # define SUN
0304 # define UNIX
0305 # ifdef CERNLIB_SOLARIS
0306 # define MACHINE_NAME "SOLARIS"
0307 # define SOLARIS
0308 # define HAVE_MEMMOVE
0309 # define HAVE_SELECT
0310 # define HAVE_STRCASECMP
0311 # define HAVE_VFORK
0312 # else
0313 # define MACHINE_NAME "SUN"
0314 # define HAVE_SELECT
0315 # define HAVE_STRCASECMP
0316 # define HAVE_VFORK
0317 # include <vfork.h>
0318 # define MATCH_RE_COMP
0319 # define GETPGRP_BSD
0320 # endif
0321 #endif
0322
0323
0324 #if defined(__ultrix)
0325 # define MACHINE_NAME "DECS"
0326 # define ULTRIX
0327 # define UNIX
0328 # define HAVE_MEMMOVE
0329 # define HAVE_STRCASECMP
0330 # define HAVE_VFORK
0331 # define NEED_STRDUP
0332 # define TERMIO_BSD
0333 # define GETPGRP_BSD
0334 # define BROKEN_F77_IO
0335 #endif
0336
0337
0338 #ifdef vms
0339 # define OS_NAME "VMS"
0340 # ifdef __ALPHA
0341 # define ALPHA
0342 # define MACHINE_NAME "ALPHA"
0343 # else
0344 # define MACHINE_NAME "VAX"
0345 # define ConCat(con,cat) concat
0346 # endif
0347 # include <clidef.h>
0348 # include <descrip.h>
0349 # include <lib$routines.h> /* lib$... prototypes */
0350 # include <processes.h>
0351 # include <rmsdef.h>
0352 # include <dvidef.h>
0353 # include <iodef.h>
0354 # include <lckdef.h>
0355 # include <lnmdef.h>
0356 # include <psldef.h>
0357 # include <ssdef.h>
0358 # include <starlet.h> /* sys$... prototypes */
0359 # include <stsdef.h>
0360 # include <ttdef.h>
0361 # include <tt2def.h>
0362 # include <unixio.h>
0363 # include <unixlib.h>
0364 # ifndef R_OK
0365 # define F_OK 0
0366 # define X_OK 1
0367 # define W_OK 2
0368 # define R_OK 4
0369 # endif
0370 # define ARG_STYLE_VMS
0371 # define F77_EXTERN_LOWERCASE
0372 # define HAVE_MEMMOVE
0373 # define HAVE_STAT_H
0374 # define HAVE_VFORK
0375 # define NO_FCNTL_H
0376 # define NO_UNISTD_H
0377 # define SIGNAL_BSD
0378 # if __VMS_VER < 70000000
0379 # define sigmask(sig) (1L << (sig-1))
0380 # endif
0381 # define USE_EDIT_SERVER
0382
0383 # if defined(VAXC) && (!defined(__DECC))
0384 # define STUPID_MALLOC
0385 # endif
0386
0387 # define fix_descriptor(dsc,str,n) \
0388 do { \
0389 dsc.dsc$b_dtype = DSC$K_DTYPE_T; \
0390 dsc.dsc$b_class = DSC$K_CLASS_S; \
0391 dsc.dsc$a_pointer = str; \
0392 dsc.dsc$w_length = n; \
0393 } while( 0 )
0394
0395 # define var_descriptor(dsc,str) \
0396 do { \
0397 dsc.dsc$b_dtype = DSC$K_DTYPE_T; \
0398 dsc.dsc$b_class = DSC$K_CLASS_S; \
0399 dsc.dsc$a_pointer = str; \
0400 dsc.dsc$w_length = strlen( dsc.dsc$a_pointer ); \
0401 } while( 0 )
0402
0403 #endif
0404
0405
0406 #include <assert.h>
0407 #include <ctype.h>
0408 #include <errno.h>
0409 #ifndef NO_FCNTL_H
0410 #include <fcntl.h>
0411 #endif
0412 #include <math.h> /* contains strtod() and strtol() on some systems */
0413 #include <setjmp.h>
0414 #include <signal.h>
0415 #include <stdio.h>
0416 #ifdef DBMALLOC
0417 extern char* getenv(const char*);
0418 extern double strtod(const char*, char**);
0419 #else
0420 #include <stdlib.h>
0421 #endif
0422 #include <time.h>
0423 #ifndef NO_UNISTD_H
0424 #include <unistd.h>
0425 #endif
0426
0427
0428 #ifndef HAVE_VFORK
0429 # define vfork fork
0430 #endif
0431
0432
0433 #ifdef UNIX
0434 # ifndef OS_NAME
0435 # define OS_NAME "UNIX"
0436 # endif
0437 # include <sys/types.h>
0438 # include <sys/stat.h>
0439 # ifndef NO_SYS_TIME_H
0440 # include <sys/time.h> /* struct timeval */
0441 # endif
0442 # if (!defined(MSDOS)) && (!defined(CERNLIB_WINNT))
0443 # include <sys/wait.h>
0444 # ifdef TERMIO_BSD
0445 # define TERMIO_MAP_NL
0446 # define HAVE_SELECT
0447 # endif
0448 # if (!defined(TERMIO_BSD)) && (!defined(TERMIO_SYSV))
0449 # define TERMIO_POSIX
0450 # endif
0451 # if defined(HAVE_SELECT) && (!defined(SELECT_CAST))
0452 # define SELECT_CAST(fds) fds
0453 # endif
0454 # include <pwd.h>
0455 # ifndef NO_DIRENT_H
0456 # include <dirent.h>
0457 # else
0458 # include <sys/dir.h> /* plus <sys/types.h> */
0459 # define dirent direct
0460 # ifndef S_IRUSR
0461 # define S_IRUSR (S_IREAD)
0462 # define S_IWUSR (S_IWRITE)
0463 # define S_IXUSR (S_IEXEC)
0464 # endif
0465 # endif
0466 # endif
0467 # define HAVE_STAT_H
0468 # ifndef NO_EDIT_SERVER
0469 # define USE_EDIT_SERVER
0470 # ifndef F_LOCK
0471 # include <sys/file.h>
0472 # define lockf(fd,op,offs) flock(fd,op)
0473 # define F_LOCK LOCK_EX
0474 # define F_ULOCK LOCK_UN
0475 # endif
0476 # endif
0477 # ifndef SLASHES
0478 # define SLASHES "/"
0479 # endif
0480 #endif
0481
0482
0483 #ifdef SUN
0484 # ifndef CLOCKS_PER_SEC
0485 # define CLOCKS_PER_SEC 1000000
0486 # define difftime(t1,t0) ((double)(t1-t0))
0487 # define raise(sig) kill(getpid(),sig)
0488 # endif
0489 #endif
0490
0491
0492 #ifndef CLOCKS_PER_SEC
0493 # define CLOCKS_PER_SEC 100
0494 #endif
0495
0496
0497 #ifdef HAVE_STAT_H
0498 # define KmTimeStamp struct stat
0499 # define get_stamp(path,stamp) stat(path,stamp)
0500 # define same_stamp(stamp1,stamp2) ((stamp2)->st_mtime == (stamp1)->st_mtime)
0501 #endif
0502
0503 #ifndef KmTimeStamp
0504 # define KmTimeStamp int
0505 # define get_stamp(path,stamp) (*(stamp) = checksum(path))
0506 # define same_stamp(stamp1,stamp2) (*(stamp1) == *(stamp2))
0507 #endif
0508
0509
0510 #ifdef MATCH_RE_COMP
0511 extern char *re_comp();
0512 extern int re_exec();
0513 #else
0514 extern char *regcmp();
0515 extern char *regex();
0516 #endif
0517
0518
0519
0520
0521 #if (!defined(ARG_STYLE_CMS)) && (!defined(ARG_STYLE_VMS))
0522 # define ARG_STYLE_UNIX
0523 #endif
0524
0525
0526 #ifndef MACHINE_NAME
0527 # define MACHINE_NAME "UNKNOWN"
0528 #endif
0529
0530 #ifndef OS_NAME
0531 # define OS_NAME "UNKNOWN"
0532 #endif
0533
0534
0535
0536 #ifndef EXTERN
0537 # define EXTERN extern
0538 #endif
0539
0540
0541
0542
0543
0544 #ifndef ConCat
0545 # define ConCat(con,cat) con##cat
0546 #endif
0547
0548
0549
0550
0551
0552 #define C_PROTO_0(name) \
0553 name(void)
0554 #define C_PROTO_1(name,arg1) \
0555 name(arg1)
0556 #define C_PROTO_2(name,arg1,arg2) \
0557 name(arg1,arg2)
0558 #define C_PROTO_3(name,arg1,arg2,arg3) \
0559 name(arg1,arg2,arg3)
0560 #define C_PROTO_4(name,arg1,arg2,arg3,arg4) \
0561 name(arg1,arg2,arg3,arg4)
0562 #define C_PROTO_5(name,arg1,arg2,arg3,arg4,arg5) \
0563 name(arg1,arg2,arg3,arg4,arg5)
0564 #define C_PROTO_6(name,arg1,arg2,arg3,arg4,arg5,arg6) \
0565 name(arg1,arg2,arg3,arg4,arg5,arg6)
0566 #define C_PROTO_7(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7) \
0567 name(arg1,arg2,arg3,arg4,arg5,arg6,arg7)
0568 #define C_PROTO_8(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8) \
0569 name(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8)
0570 #define C_PROTO_9(name,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9) \
0571 name(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
0572 #define C_PROTO_13(name,a1,a2,a3,a4,a5,a6,a7,a8,a9,b0,b1,b2,b3) \
0573 name(a1,a2,a3,a4,a5,a6,a7,a8,a9,b0,b1,b2,b3)
0574
0575 #define C_DECL_1(name,t1,p1) \
0576 name(t1 p1)
0577 #define C_DECL_2(name,t1,p1,t2,p2) \
0578 name(t1 p1,t2 p2)
0579 #define C_DECL_3(name,t1,p1,t2,p2,t3,p3) \
0580 name(t1 p1,t2 p2,t3 p3)
0581 #define C_DECL_4(name,t1,p1,t2,p2,t3,p3,t4,p4) \
0582 name(t1 p1,t2 p2,t3 p3,t4 p4)
0583 #define C_DECL_5(name,t1,p1,t2,p2,t3,p3,t4,p4,t5,p5) \
0584 name(t1 p1,t2 p2,t3 p3,t4 p4,t5 p5)
0585 #define C_DECL_6(name,t1,p1,t2,p2,t3,p3,t4,p4,t5,p5,t6,p6) \
0586 name(t1 p1,t2 p2,t3 p3,t4 p4,t5 p5,t6 p6)
0587 #define C_DECL_7(name,t1,p1,t2,p2,t3,p3,t4,p4,t5,p5,t6,p6,t7,p7) \
0588 name(t1 p1,t2 p2,t3 p3,t4 p4,t5 p5,t6 p6,t7 p7)
0589 #define C_DECL_8(name,t1,p1,t2,p2,t3,p3,t4,p4,t5,p5,t6,p6,t7,p7,t8,p8) \
0590 name(t1 p1,t2 p2,t3 p3,t4 p4,t5 p5,t6 p6,t7 p7,t8 p8)
0591 #define C_DECL_9(name,t1,p1,t2,p2,t3,p3,t4,p4,t5,p5,t6,p6,t7,p7,t8,p8,t9,p9)\
0592 name(t1 p1,t2 p2,t3 p3,t4 p4,t5 p5,t6 p6,t7 p7,t8 p8,t9 p9)
0593 #define C_DECL_13(name,t1,p1,t2,p2,t3,p3,t4,p4,t5,p5,t6,p6,t7,p7,t8,p8,\
0594 t9,p9,t10,p10,t11,p11,t12,p12,t13,p13) \
0595 name(t1 p1,t2 p2,t3 p3,t4 p4,t5 p5,t6 p6,t7 p7,t8 p8,\
0596 t9 p9,t10 p10,t11 p11,t12 p12,t13 p13)
0597
0598
0599 typedef int IntFunc();
0600 typedef char* CharFunc();
0601 typedef char** pCharFunc();
0602
0603