From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- unix/portkit/README | 356 +++++++++++++++++++++++++++++++++++++++++ unix/portkit/d1mach.f.ieee | 273 +++++++++++++++++++++++++++++++ unix/portkit/i1mach.f.ieee | 379 ++++++++++++++++++++++++++++++++++++++++++++ unix/portkit/ishift.s.68000 | 44 +++++ unix/portkit/mach.h.ieee | 37 +++++ unix/portkit/r1mach.f.ieee | 191 ++++++++++++++++++++++ unix/portkit/spp.h.ieee | 139 ++++++++++++++++ unix/portkit/zsvjmp.s.68000 | 37 +++++ unix/portkit/zsvjmp.s.FX | 49 ++++++ unix/portkit/zsvjmp.s.HP800 | 48 ++++++ unix/portkit/zsvjmp.s.ISI | 52 ++++++ unix/portkit/zsvjmp.s.SPARC | 59 +++++++ 12 files changed, 1664 insertions(+) create mode 100644 unix/portkit/README create mode 100644 unix/portkit/d1mach.f.ieee create mode 100644 unix/portkit/i1mach.f.ieee create mode 100644 unix/portkit/ishift.s.68000 create mode 100644 unix/portkit/mach.h.ieee create mode 100644 unix/portkit/r1mach.f.ieee create mode 100644 unix/portkit/spp.h.ieee create mode 100644 unix/portkit/zsvjmp.s.68000 create mode 100644 unix/portkit/zsvjmp.s.FX create mode 100644 unix/portkit/zsvjmp.s.HP800 create mode 100644 unix/portkit/zsvjmp.s.ISI create mode 100644 unix/portkit/zsvjmp.s.SPARC (limited to 'unix/portkit') diff --git a/unix/portkit/README b/unix/portkit/README new file mode 100644 index 00000000..17177d88 --- /dev/null +++ b/unix/portkit/README @@ -0,0 +1,356 @@ +UNIX/IRAF (Berkeley UNIX) Porting Notes +18 January 1986 (dct), 28 March 1988 (sr) +----------------------------------------- + +The 4.3BSD VAX version of UNIX/IRAF will run almost without change on other +BSD-based systems. In particular, the kernel should not have to be changed. +The changes which are required are due to machine differences, e.g., in the +assemblers and machine constants. The affected files are summarized below. + +Source for much of the existing IRAF system documentation is in the +directory iraf/doc, with notes on previous ports in iraf/doc/ports. +Other documentation is generally in "doc" subdirectories throughout the system. +It is useful to be familiar with Doug Tody's paper "The IRAF Data Reduction and +Analysis System" (IRAF System Handbook, Vol. 3A), as it is with "A Reference +Manual for the IRAF System Interface" (Vol. 3B). You will want to read and +refer to the UNIX/IRAF Installation and Maintenance Guide as well. + +Please keep a detailed notes file in $iraf/local on any files edited for +the port, similar to the ones in "$iraf/doc/ports". + +Virtually all the work on the port (excluding any new device interfaces) +should be in the Host System Interface (HSI) directories, which in this +case are rooted at "iraf/unix". A source tape may also contain other HSI's, +such as "iraf/vms". + +Summary of Steps Required for a BSD-derived UNIX Port + + o create the `iraf' account and root directory + o read the source distribution tape (UNIX "tar" format) + o edit system-dependent files in the HSI + o bootstrap the HSI utilities + o test the bootstrap utilities + o perform a full IRAF sysgen + o configure the device tables and complete the installation + o test and benchmark the system + +Edit the Files that Describe the Host System +------------------------------------------------------------------------------ +The Host System Interface comprises all the subdirectories of "$iraf/unix", +but in general for a new port only a handful of files need be modified; the +most likely of these are listed here. + +unix/as/*.s + All of the assembler sources are of course different for a VAX and + other machines. The various UNIX assemblers for the MC68000 + UNIX implementations are also different, e.g., in the comment + convention, use of $ or # to denote a numeric constant, etc. + Despite the differences there are many similarities, and the + translation is usually not difficult. Note that only a couple of + assembler sources are required, although half a dozen or so should + eventually be implemented for efficiency reasons. + + To modify the AS directory for a non-VAX, rename the original + AS directory to "vaxas", create a new "as" directory, and code at + least ZSVJMP.S (see below) for your machine. Other assembler routines + in "vaxas" may be coded later for enhanced efficiency. + +unix/as/zsvjmp.s + The "zsvjmp.s" distributed in the source tape is for VAX/UNIX. + This is the only assembler routine required for running IRAF; + it executes a non-local goto in the context of the "calling routine" + (this is why we cannot simply use the UNIX "setjmp / longjmp" + calls directly). See also LEN_JMPBUF in config.h and spp.h. + + In the VAX "zsvjmp.s" the location of the "mem" common block is fixed + at virtual address zero. This is desirable, but not essential. + However, it is essential that it be at least aligned to an even 64-bit + boundary in memory, due to requirements of the SPP language. + + Note that as long as the library function "setjmp(3)" is implemented, + all "zsvjmp.s" has to do is manipulate a few words, and jump to "setjmp" + without putting anything on the stack. + +pkg/cl/main.c +pkg/cl/pfiles.c + In a recent port to a machine requiring 64-bit alignment of double + precision words in memory (HP-9000 Series 800), we had to modify some + code in these two files. The symptom showed up after the CL was + running, when giving the command "lpar urand" after loading the + "utilities" package; a fatal bus error ensued. We have not checked + the fix out thoroughly yet, so it is not merged into the master + system. If you run into a situation like this, please contact me for + the modification. + +unix/boot/mkpkg/scanlib.c + This file contains code that opens and reads IRAF object libraries + in order to compare the insertion dates against source file dates. + Not all UNIX systems store the date or module names the same way, + so if you later find that MKPKG is always recompiling all modules, + you will need to modify this file. + +unix/boot/spp/xc.c + This is the IRAF XC compiler. Among other things, it preprocesses + SPP code into Fortran and executes the host system compilers and linker. + Examine the occurrences of "f77" and "cc", and make sure the right + libraries are in FORTLIB[123]. It is assumed that "f77" can compile C + code and "cc" can run the loader in the current version, requiring + minor code additions if not. + +unix/boot/spp/rpp/ratlibc/ratdef.h + If your compilers do anything with Fortran external identifiers other + than appending an underscore to them, including leaving them intact, + edit this file. + +unix/boot/spp/rpp/ratlibc/ratdef.h + If your Fortran compiler does anything with external identifiers + other than appending a trailing underscore (including doing nothing + with them at all), edit this file. In it, the names of Fortran + routines that may be called from C are given with the trailing + underscore. + +unix/boot/spp/xpp/xppcode.c + See the comments about type coercion for INT2 and INT4, and edit if + necessary. + +unix/gdev/* + No changes should be required, unless new graphics devices have to be + interfaced. + +unix/hlib/config.h + This file should be inspected for machine dependencies; e.g., + LEN_JUMPBUF may need modification; note that it should be 1 greater + than what is allocated for "jmp_buf" in "". + +unix/hlib/iraf.h + Do not confuse this file with the "iraf.h" in hlib/libc (which is for + inclusion in C programs). There are several things to check in this + file, e.g. the value of the "indefinites" INDEFR, etc. In particular, + be sure to map the Fortran intrinsics "and, or, xor," and "not" if + your Fortran compiler uses different names for them. Also, if Fortran + external identifiers are not distinguished from their C counterparts + automatically by the compilers, there may be some name collisions + between SPP and C routines, which would show up as runtime errors. + (E.g. if "blogs" were both an SPP routine and a UNIX routine, rename + "blogs" to "xblogs" or something in iraf.h [and libc/xnames.h]. + In a recent port we redefined "getpid" as "xgetpd", "rename" as + "xfrnam", and "getuid" as "xgetud".) + +unix/hlib/irafuser.csh + Edit the three compile/link flags (HSI_**) for the Host System Interface + routines -- there is little or no floating point used in the HSI. + Also edit the pathname to the IRAF root directory if yours is different. + +unix/hlib/mach.h (see portkit/mach.h.ieee) +unix/hlib/[dir]1mach.f (see portkit/[dir]1mach.f.ieee) + Change the machine constants to those for your hardware. If the machine + has IEEE floating point, these constants are independent of the host + operating system (e.g., SUN or ISI). The directory "unix/portkit" + contains several files ending in ".ieee" as examples. These files + should not be used to simply replace those in the distributed source + tape, as they may not be up to date; a diff/merge is recommended, or + just use them for reference in editing the distributed versions. + + In only the machine epsilon and byte-swap flags usually need + to be changed; the values for INDEF, MAX_LONG, etc. are the same for + most modern minicomputers. + + The utility $iraf/sys/osb$zzeps.f may be used to determine the machine + epsilon. The values determined for a SUN/MC68020 with software + floating point were the following: + + EPSILONR (1.192e-7) + EPSILOND (2.220d-16) + + BYTE_SWAP = NO means the most significant byte of a word comes first + in a stream of bytes, as in the MC68*** machines (this is called + "big-endian"). VAXes have swapped bytes. Note the examples in + $iraf/unix/portkit/*.IEEE. + +unix/hlib/mkiraf.csh + Change the IRAF root pathnames in these files. + +unix/hlib/libc/iraf.h +/usr/include/iraf.h -> $iraf/unix/hlib/libc/iraf.h + Replace ALL existing occurrences of the IRAF root pathname with your + own pathname to the IRAF root directory. This would normally be + done by the "install" script, but you may not wish to install IRAF + solely for purposes of the port. Also edit the value of TMP to be + the location of a publicly writeable scratch directory. If symbolic + links are available, simply establish one in "/usr/include" pointing + to "iraf.h" (you probably have to be superuser to do this). If not, + copy "iraf.h" to "/usr/include", and remember to do so again after any + subsequent edits. + +unix/hlib/libc/kernel.h + The only parameter which might need to be modified is _NFILE, which + should reflect the host sytem's open file capacity (this will be defined + in in many BSD derived systems). + +unix/hlib/libc/knames.h + If your compilers do anything with Fortran external identifiers other + than appending an underscore to them, including leaving them intact, + edit this file. + +unix/hlib/libc/libc.h + "libc.h" contains some definitions for external names of certain + Fortran identifiers such as common blocks -- in a few places, C + code needs access to these locations (see paragraph labelled + "[MACHDEP]"). On the VAX, all f77 external identifiers are given + a trailing underscore. + +unix/hlib/libc/spp.h (see portkit/spp.h.ieee) + Enter the EPSILON[RD]'s determined earlier for hlib/mach.h and the + INDEF's. Also, make sure LEN_JUMPBUF matches the one in + "hlib/config.h". In general, look for the string "MACHDEP" in these + files. + +unix/hlib/libc/xnames.h + See comments under "unix/hlib/iraf.h" concerning name collisions. + +unix/os/zxwhen.c + This file contains machine-specific hardware exception codes. + +This ends the list of likely source files to be edited. +Later, when installing a new version of UNIX/IRAF it is usually best to +install the new UNIX directories as well, and then modify or replace the +above files as necessary for your machine. All revisions are thus +automatically picked up, and the modifications required for your machine +are probably relatively minor. + + +Bootstrap the HSI Utilities +------------------------------------------------------------------------ +This may take a while (10's of minutes), so it is advisable to spool the +output. + + % cd $iraf/unix + % sh -x mkpkg.sh >& spool & + +Examine the spool file for any compilation errors and attempt to deduce +and correct any that are encountered. + +Test the Bootstrap Utilities +-------------------------------------------------------------------------------- +When the bootstrap has completed successfully, it is time to test the +bootstrap utilities. The most important of these are XC and MKPKG. +For purposes of a port, you may establish symbolic links to the bootstrap +utilities and later runtime executables within the IRAF directory system, rather +than in a public directory. This should be "$iraf/local/bin". +Edit the ".login" file of the "iraf" account to include +"$iraf/local/bin" in its search path, and establish the links as follows: + +% cd $iraf/local +% mkdir bin +% cd $iraf/local/bin +% ln -s $iraf/bin/cl.e cl +% ln -s $iraf/unix/hlib/generic.e generic +% ln -s $iraf/unix/hlib/mkiraf.csh mkiraf +% ln -s $iraf/unix/hlib/mkmlist.csh mkmlist +% ln -s $iraf/unix/hlib/mkpkg.e mkpkg +% ln -s $iraf/unix/hlib/rmbin.e rmbin +% ln -s $iraf/unix/hlib/rmfiles.e rmfiles +% ln -s $iraf/unix/hlib/rtar.e rtar +% ln -s $iraf/unix/hlib/sgidispatch.e sgidispatch +% ln -s $iraf/unix/hlib/wtar.e wtar +% ln -s $iraf/unix/hlib/xc.e xc" + +unix/hlib/mkpkg.inc + Edit "mkpkg.inc" to establish compiler and linker switches for SPP + programs. + +unix/hlib/mkpkg.sf + The special file list "mkpkg.sf" will be involved later, if compiler + bugs during a sysgen require special compilation (e.g. without + optimization). In a recent port to a vector machine, separate MKPKG + flags were created for several classes of routines, those benefitting + from vectorization, those calling lower-level C routines, etc. + Contact us if you feel your Fortran compiler may have similar needs + (if so, a number of "mkpkg" files in various directories will also + need to be edited). + +Perform an IRAF Sysgen +-------------------------------------------------------------------------------- +If the bootstrap utilities appear to be in good shape, it is time to perform +a full IRAF sysgen. This will preprocess all the SPP code in IRAF into +Fortran, compile and delete the intermediate Fortran source, load all +the object libraries, and link the executables. There are invariably +problems with the Fortran compiler. There will probably be some compile +time compiler failures, maybe some linker failures, and probably some run +time IRAF bugs that end up being due to compiler bugs, usually +in the optimizer. IRAF is a large system, and we haven't gotten +through an installation yet on any host where this was not the case +(although in a couple of recent ports only a few files were affected). +You will definitely want to spool the output; even on fast machines a +full sysgen may take over 5 hours. + + % cd $iraf + % mkpkg >& spool & + +You will certainly have to perform the sysgen multiple times, as you identify +and correct problems. Files successfully compiled and loaded into object +libraries will not be compiled in succeeding sysgens, so each one takes less +time than its predecessor. Be sure to inspect the spoolfile during or after +your second sysgen to make sure this is the case. If all files are being +automatically recompiled, there is something wrong with the routine that +compares file dates in the object libraries with source file dates. Library +module dates are determined in iraf$unix/boot/mkpkg/scanlib.c, module +h_scanlibrary. Note that the bootstrap utility RMBIN may be used to +remove binary files should this be desired during multiple cycles of sysgens. + +The hardest part starts when you begin debugging problems with +the run-time system; it helps to know IRAF well enough to know how +something is supposed to work. This could well be the most labor-intensive +part of the port. Note that the file "$iraf/unix/hlib/mkpkg.sf" is +used for handling files requiring special compilation. + +Test and Benchmark the System +-------------------------------------------------------------------------------- +If all the preceding steps are complete, you are ready to begin testing +the system. A normal user would run "mkiraf" from their +desired IRAF home directory ("$iraf/local" for the IRAF account itself) +to tailor the runtime environment. Since you are doing a port instead, +you may want to simply edit the startup file ("$iraf/local/login.cl") +for the two environment variables "home" and "imdir". Most +users locate their bulk image storage directory on a temp disk +to simplify disk backups, but to keep the port compact, you could +instead create a pixel storage directory under "$iraf/local". +Edit "$iraf/local/login.cl"; replace the home directory below with +your own: + + set home = "/iraf/local/" + set imdir = "home$pix/" + +The test procedures assume a complete installation, so even though +you don't know if the port is successful yet, you might as well configure +the device tables and complete the installation as in the "UNIX/IRAF +Installation and Maintenance Guide", section 2.3 (at least install the +magtape devices in "dev$devices" as in section 2.3.2). Since +we cannot guarantee that a binary image file from a VAX/UNIX system +will be readable by an arbitrary host system, we will have you delete +the old binary image (currently implemented as three files), then +unpack a machine-independent image file to replace it. Contact us +if the file "fitspix" is not present in the $iraf/dev directory. + + % cd $iraf/local + % cl + [IRAF banner, message of the day, top-level packages.] + cl> cd dev + cl> delete pix.imh,..pix.imh,pix.pix # if present + cl> set imdir = HDR$ + cl> dataio + da> rfits fitspix 1 pix + da> bye + cl> cd local + cl> mkdir pix + cl> reset imdir = "home$pix/" + +You may now undertake the Test Procedures in Volume 1A of the IRAF User +Handbook. + +Benchmark the System +-------------------------------------------------------------------------------- +When the system is running reasonably well and is bug-free, you can +accomplish further testing by running the Benchmark Utilities. See the +paper entitled "A Set of Benchmarks for Measuring IRAF System Performance", +in the IRAF System Handbook, Volume 3A. diff --git a/unix/portkit/d1mach.f.ieee b/unix/portkit/d1mach.f.ieee new file mode 100644 index 00000000..22bc2512 --- /dev/null +++ b/unix/portkit/d1mach.f.ieee @@ -0,0 +1,273 @@ +c +c---------------------------------------------------------------------- +c function: d1mach +c this routine is from the port mathematical subroutine library +c it is described in the bell laboratories computing science +c technical report #47 by p.a. fox, a.d. hall and n.l. schryer +c a modification to the "i out of bounds" error message +c has been made by c. a. mcgonegal - april, 1978 +c---------------------------------------------------------------------- +c + double precision function d1mach(i) +c +c double-precision machine constants +c +c d1mach( 1) = b**(emin-1), the smallest positive magnitude. +c +c d1mach( 2) = b**emax*(1 - b**(-t)), the largest magnitude. +c +c d1mach( 3) = b**(-t), the smallest relative spacing. +c +c d1mach( 4) = b**(1-t), the largest relative spacing. +c +c d1mach( 5) = log10(b) +c +c to alter this function for a particular environment, +c the desired set of data statements should be activated by +c removing the c from column 1. +c +c where possible, octal or hexadecimal constants have been used +c to specify the constants exactly which has in some cases +c required the use of equivalent integer arrays. +c + integer small(4) + integer large(4) + integer right(4) + integer diver(4) + integer log10(4) +c + double precision dmach(5) +c + equivalence (dmach(1),small(1)) + equivalence (dmach(2),large(1)) + equivalence (dmach(3),right(1)) + equivalence (dmach(4),diver(1)) + equivalence (dmach(5),log10(1)) +c +c machine constants for the burroughs 1700 system. +c +c data small(1) / zc00800000 / +c data small(2) / z000000000 / +c +c data large(1) / zdffffffff / +c data large(2) / zfffffffff / +c +c data right(1) / zcc5800000 / +c data right(2) / z000000000 / +c +c data diver(1) / zcc6800000 / +c data diver(2) / z000000000 / +c +c data log10(1) / zd00e730e7 / +c data log10(2) / zc77800dc0 / +c +c machine constants for the burroughs 5700 system. +c +c data small(1) / o1771000000000000 / +c data small(2) / o0000000000000000 / +c +c data large(1) / o0777777777777777 / +c data large(2) / o0007777777777777 / +c +c data right(1) / o1461000000000000 / +c data right(2) / o0000000000000000 / +c +c data diver(1) / o1451000000000000 / +c data diver(2) / o0000000000000000 / +c +c data log10(1) / o1157163034761674 / +c data log10(2) / o0006677466732724 / +c +c machine constants for the burroughs 6700/7700 systems. +c +c data small(1) / o1771000000000000 / +c data small(2) / o7770000000000000 / +c +c data large(1) / o0777777777777777 / +c data large(2) / o7777777777777777 / +c +c data right(1) / o1461000000000000 / +c data right(2) / o0000000000000000 / +c +c data diver(1) / o1451000000000000 / +c data diver(2) / o0000000000000000 / +c +c data log10(1) / o1157163034761674 / +c data log10(2) / o0006677466732724 / +c +c machine constants for the cdc 6000/7000 series. +c +c data small(1) / 00604000000000000000b / +c data small(2) / 00000000000000000000b / +c +c data large(1) / 37767777777777777777b / +c data large(2) / 37167777777777777777b / +c +c data right(1) / 15604000000000000000b / +c data right(2) / 15000000000000000000b / +c +c data diver(1) / 15614000000000000000b / +c data diver(2) / 15010000000000000000b / +c +c data log10(1) / 17164642023241175717b / +c data log10(2) / 16367571421742254654b / +c +c machine constants for the cray 1 +c +c data small(1) / 200004000000000000000b / +c data small(2) / 000000000000000000000b / +c +c data large(1) / 577767777777777777777b / +c data large(2) / 000007777777777777776b / +c +c data right(1) / 376424000000000000000b / +c data right(2) / 000000000000000000000b / +c +c data diver(1) / 376434000000000000000b / +c data diver(2) / 000000000000000000000b / +c +c data log10(1) / 377774642023241175717b / +c data log10(2) / 000007571421742254654b / +c +c machine constants for the data general eclipse s/200 +c +c note - it may be appropriate to include the following card - +c static dmach(5) +c +c data small/20k,3*0/,large/77777k,3*177777k/ +c data right/31420k,3*0/,diver/32020k,3*0/ +c data log10/40423k,42023k,50237k,74776k/ +c +c machine constants for the harris slash 6 and slash 7 +c +c data small(1),small(2) / '20000000, '00000201 / +c data large(1),large(2) / '37777777, '37777577 / +c data right(1),right(2) / '20000000, '00000333 / +c data diver(1),diver(2) / '20000000, '00000334 / +c data log10(1),log10(2) / '23210115, '10237777 / +c +c machine constants for the honeywell 600/6000 series. +c +c data small(1),small(2) / o402400000000, o000000000000 / +c data large(1),large(2) / o376777777777, o777777777777 / +c data right(1),right(2) / o604400000000, o000000000000 / +c data diver(1),diver(2) / o606400000000, o000000000000 / +c data log10(1),log10(2) / o776464202324, o117571775714 / +c +c machine constants for the ibm 360/370 series, +c the xerox sigma 5/7/9 and the sel systems 85/86. +c +c data small(1),small(2) / z00100000, z00000000 / +c data large(1),large(2) / z7fffffff, zffffffff / +c data right(1),right(2) / z33100000, z00000000 / +c data diver(1),diver(2) / z34100000, z00000000 / +c data log10(1),log10(2) / z41134413, z509f79ff / +c +c machine constants for the pdp-10 (ka processor). +c +c data small(1),small(2) / "033400000000, "000000000000 / +c data large(1),large(2) / "377777777777, "344777777777 / +c data right(1),right(2) / "113400000000, "000000000000 / +c data diver(1),diver(2) / "114400000000, "000000000000 / +c data log10(1),log10(2) / "177464202324, "144117571776 / +c +c machine constants for the pdp-10 (ki processor). +c +c data small(1),small(2) / "000400000000, "000000000000 / +c data large(1),large(2) / "377777777777, "377777777777 / +c data right(1),right(2) / "103400000000, "000000000000 / +c data diver(1),diver(2) / "104400000000, "000000000000 / +c data log10(1),log10(2) / "177464202324, "476747767461 / +c +c machine constants for pdp-11 fortran's supporting +c 32-bit integers (expressed in integer and octal). +c + data small(1),small(2) / 8388608, 0 / + data large(1),large(2) / 2147483647, -1 / + data right(1),right(2) / 612368384, 0 / + data diver(1),diver(2) / 620756992, 0 / + data log10(1),log10(2) / 1067065498, -2063872008 / +c +c data small(1),small(2) / o00040000000, o00000000000 / +c data large(1),large(2) / o17777777777, o37777777777 / +c data right(1),right(2) / o04440000000, o00000000000 / +c data diver(1),diver(2) / o04500000000, o00000000000 / +c data log10(1),log10(2) / o07746420232, o20476747770 / +c +c machine constants for pdp-11 fortran's supporting +c 16-bit integers (expressed in integer and octal). +c +c data small(1),small(2) / 128, 0 / +c data small(3),small(4) / 0, 0 / +c +c data large(1),large(2) / 32767, -1 / +c data large(3),large(4) / -1, -1 / +c +c data right(1),right(2) / 9344, 0 / +c data right(3),right(4) / 0, 0 / +c +c data diver(1),diver(2) / 9472, 0 / +c data diver(3),diver(4) / 0, 0 / +c +c data log10(1),log10(2) / 16282, 8346 / +c data log10(3),log10(4) / -31493, -12296 / +c +c data small(1),small(2) / o000200, o000000 / +c data small(3),small(4) / o000000, o000000 / +c +c data large(1),large(2) / o077777, o177777 / +c data large(3),large(4) / o177777, o177777 / +c +c data right(1),right(2) / o022200, o000000 / +c data right(3),right(4) / o000000, o000000 / +c +c data diver(1),diver(2) / o022400, o000000 / +c data diver(3),diver(4) / o000000, o000000 / +c +c data log10(1),log10(2) / o037632, o020232 / +c data log10(3),log10(4) / o102373, o147770 / +c +c machine constants for the univac 1100 series. +c +c data small(1),small(2) / o000040000000, o000000000000 / +c data large(1),large(2) / o377777777777, o777777777777 / +c data right(1),right(2) / o170540000000, o000000000000 / +c data diver(1),diver(2) / o170640000000, o000000000000 / +c data log10(1),log10(2) / o177746420232, o411757177572 / +c +c machine constants for the vax-11 with +c fortran iv-plus compiler +c +c data small(1),small(2) / z00000080, z00000000 / +c data large(1),large(2) / zffff7fff, zffffffff / +c data right(1),right(2) / z00002480, z00000000 / +c data diver(1),diver(2) / z00002500, z00000000 / +c data log10(1),log10(2) / z209a3f9a, zcffa84fb / +c +c machine constants for IEEE floating point standard on 68000. First +c expressed as hex constants, then as two word integer. +c +c data small(1), small(2) / x'00080000', x'00000000' / +c data large(1), large(2) / x'7FDFFFFF', x'FFFFFFFF' / +c data right(1), right(2) / x'3CA00000', x'00000000' / +c data diver(1), diver(2) / x'3CB00000', x'00000000' / +c data log10(1), log10(2) / x'3FE62E42', x'FEFA39EF' / +c +c These IEEE values are written as integer constants below - +c +c data small(1),small(2) /524288, 0/ +c data large(1),large(2) /2145386495, -1/ +c data right(1),right(2) /970, 0/ +c data diver(1),diver(2) /971, 0/ +c data log10(1),log10(2) /1072049730, -17155601/ +c +c if (i .lt. 1 .or. i .gt. 5) goto 100 +c + d1mach = dmach(i) + return +c +c100 iwunit = i1mach(4) +c write(iwunit, 99) +c 99 format(24hd1mach - i out of bounds) +c stop + end diff --git a/unix/portkit/i1mach.f.ieee b/unix/portkit/i1mach.f.ieee new file mode 100644 index 00000000..cac890bd --- /dev/null +++ b/unix/portkit/i1mach.f.ieee @@ -0,0 +1,379 @@ +c i1mach from portlib 03/25/82 + integer function i1mach(i) +c +c i/o unit numbers. +c +c i1mach( 1) = the standard input unit. +c +c i1mach( 2) = the standard output unit. +c +c i1mach( 3) = the standard punch unit. +c +c i1mach( 4) = the standard error message unit. +c +c words. +c +c i1mach( 5) = the number of bits per integer storage unit. +c +c i1mach( 6) = the number of characters per integer storage unit. +c +c integers. +c +c assume integers are represented in the s-digit, base-a form +c +c sign ( x(s-1)*a**(s-1) + ... + x(1)*a + x(0) ) +c +c where 0 .le. x(i) .lt. a for i=0,...,s-1. +c +c i1mach( 7) = a, the base. +c +c i1mach( 8) = s, the number of base-a digits. +c +c i1mach( 9) = a**s - 1, the largest magnitude. +c +c floating-point numbers. +c +c assume floating-point numbers are represented in the t-digit, +c base-b form +c +c sign (b**e)*( (x(1)/b) + ... + (x(t)/b**t) ) +c +c where 0 .le. x(i) .lt. b for i=1,...,t, +c 0 .lt. x(1), and emin .le. e .le. emax. +c +c i1mach(10) = b, the base. +c +c single-precision +c +c i1mach(11) = t, the number of base-b digits. +c +c i1mach(12) = emin, the smallest exponent e. +c +c i1mach(13) = emax, the largest exponent e. +c +c double-precision +c +c i1mach(14) = t, the number of base-b digits. +c +c i1mach(15) = emin, the smallest exponent e. +c +c i1mach(16) = emax, the largest exponent e. +c +c to alter this function for a particular environment, +c the desired set of data statements should be activated by +c removing the c from column 1. also, the values of +c i1mach(1) - i1mach(4) should be checked for consistency +c with the local operating system. +c + integer imach(16),output +c + equivalence (imach(4),output) +c +c machine constants for the burroughs 1700 system. +c +c data imach( 1) / 7 / +c data imach( 2) / 2 / +c data imach( 3) / 2 / +c data imach( 4) / 2 / +c data imach( 5) / 36 / +c data imach( 6) / 4 / +c data imach( 7) / 2 / +c data imach( 8) / 33 / +c data imach( 9) / z1ffffffff / +c data imach(10) / 2 / +c data imach(11) / 24 / +c data imach(12) / -256 / +c data imach(13) / 255 / +c data imach(14) / 60 / +c data imach(15) / -256 / +c data imach(16) / 255 / +c +c machine constants for the burroughs 5700 system. +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 7 / +c data imach( 4) / 6 / +c data imach( 5) / 48 / +c data imach( 6) / 6 / +c data imach( 7) / 2 / +c data imach( 8) / 39 / +c data imach( 9) / o0007777777777777 / +c data imach(10) / 8 / +c data imach(11) / 13 / +c data imach(12) / -50 / +c data imach(13) / 76 / +c data imach(14) / 26 / +c data imach(15) / -50 / +c data imach(16) / 76 / +c +c machine constants for the burroughs 6700/7700 systems. +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 7 / +c data imach( 4) / 6 / +c data imach( 5) / 48 / +c data imach( 6) / 6 / +c data imach( 7) / 2 / +c data imach( 8) / 39 / +c data imach( 9) / o0007777777777777 / +c data imach(10) / 8 / +c data imach(11) / 13 / +c data imach(12) / -50 / +c data imach(13) / 76 / +c data imach(14) / 26 / +c data imach(15) / -32754 / +c data imach(16) / 32780 / +c +c machine constants for the cdc 6000/7000 series. +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 7 / +c data imach( 4) / 6 / +c data imach( 5) / 60 / +c data imach( 6) / 10 / +c data imach( 7) / 2 / +c data imach( 8) / 48 / +c data imach( 9) / 00007777777777777777b / +c data imach(10) / 2 / +c data imach(11) / 48 / +c data imach(12) / -974 / +c data imach(13) / 1070 / +c data imach(14) / 96 / +c data imach(15) / -927 / +c data imach(16) / 1070 / +c +c machine constants for the cray 1 +c +c data imach( 1) / 100 / +c data imach( 2) / 101 / +c data imach( 3) / 102 / +c data imach( 4) / 101 / +c data imach( 5) / 64 / +c data imach( 6) / 8 / +c data imach( 7) / 2 / +c data imach( 8) / 63 / +c data imach( 9) / 777777777777777777777b / +c data imach(10) / 2 / +c data imach(11) / 48 / +c data imach(12) / -8192 / +c data imach(13) / 8191 / +c data imach(14) / 96 / +c data imach(15) / -8192 / +c data imach(16) / 8191 / +c +c machine constants for the data general eclipse s/200 +c +c data imach( 1) / 11 / +c data imach( 2) / 12 / +c data imach( 3) / 8 / +c data imach( 4) / 10 / +c data imach( 5) / 16 / +c data imach( 6) / 2 / +c data imach( 7) / 2 / +c data imach( 8) / 15 / +c data imach( 9) /32767 / +c data imach(10) / 16 / +c data imach(11) / 6 / +c data imach(12) / -64 / +c data imach(13) / 63 / +c data imach(14) / 14 / +c data imach(15) / -64 / +c data imach(16) / 63 / +c +c machine constants for the harris 220 +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 0 / +c data imach( 4) / 6 / +c data imach( 5) / 24 / +c data imach( 6) / 3 / +c data imach( 7) / 2 / +c data imach( 8) / 23 / +c data imach( 9) / 8388607 / +c data imach(10) / 2 / +c data imach(11) / 23 / +c data imach(12) / -127 / +c data imach(13) / 127 / +c data imach(14) / 38 / +c data imach(15) / -127 / +c data imach(16) / 127 / +c +c machine constants for the honeywell 600/6000 series. +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 43 / +c data imach( 4) / 6 / +c data imach( 5) / 36 / +c data imach( 6) / 6 / +c data imach( 7) / 2 / +c data imach( 8) / 35 / +c data imach( 9) / 0377777777777 / +c data imach(10) / 2 / +c data imach(11) / 27 / +c data imach(12) / -127 / +c data imach(13) / 127 / +c data imach(14) / 63 / +c data imach(15) / -127 / +c data imach(16) / 127 / +c +c machine constants for the ibm 360/370 series. +c the xerox sigma 5/7/9 and the sel systems 85/86. +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 7 / +c data imach( 4) / 6 / +c data imach( 5) / 32 / +c data imach( 6) / 4 / +c data imach( 7) / 2 / +c data imach( 8) / 31 / +c data imach( 9) / z7fffffff / +c data imach(10) / 16 / +c data imach(11) / 6 / +c data imach(12) / -64 / +c data imach(13) / 63 / +c data imach(14) / 14 / +c data imach(15) / -64 / +c data imach(16) / 63 / +c +c machine constants for the pdp-10 (ka processor). +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 5 / +c data imach( 4) / 6 / +c data imach( 5) / 36 / +c data imach( 6) / 5 / +c data imach( 7) / 2 / +c data imach( 8) / 35 / +c data imach( 9) / "377777777777 / +c data imach(10) / 2 / +c data imach(11) / 27 / +c data imach(12) / -128 / +c data imach(13) / 127 / +c data imach(14) / 54 / +c data imach(15) / -101 / +c data imach(16) / 127 / +c +c machine constants for the pdp-10 (ki processor). +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 5 / +c data imach( 4) / 6 / +c data imach( 5) / 36 / +c data imach( 6) / 5 / +c data imach( 7) / 2 / +c data imach( 8) / 35 / +c data imach( 9) / "377777777777 / +c data imach(10) / 2 / +c data imach(11) / 27 / +c data imach(12) / -128 / +c data imach(13) / 127 / +c data imach(14) / 62 / +c data imach(15) / -128 / +c data imach(16) / 127 / +c +c machine constants for pdp-11 fortran"s supporting +c 32-bit integer arithmetic. +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 5 / +c data imach( 4) / 6 / +c data imach( 5) / 32 / +c data imach( 6) / 4 / +c data imach( 7) / 2 / +c data imach( 8) / 31 / +c data imach( 9) / 2147483647 / +c data imach(10) / 2 / +c data imach(11) / 24 / +c data imach(12) / -127 / +c data imach(13) / 127 / +c data imach(14) / 56 / +c data imach(15) / -127 / +c data imach(16) / 127 / +c +c machine constants for pdp-11 fortran"s supporting +c 16-bit integer arithmetic. +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 5 / +c data imach( 4) / 6 / +c data imach( 5) / 16 / +c data imach( 6) / 2 / +c data imach( 7) / 2 / +c data imach( 8) / 15 / +c data imach( 9) /32767 / +c data imach(10) / 2 / +c data imach(11) / 24 / +c data imach(12) / -127 / +c data imach(13) / 127 / +c data imach(14) / 56 / +c data imach(15) / -127 / +c data imach(16) / 127 / +c +c machine constants for the univac 1100 series. +c +c note that the punch unit, i1mach(3), has been set to 7 +c which is appropriate for the univac-for system. +c if you have the univac-ftn system, set it to 1. +c +c data imach( 1) / 5 / +c data imach( 2) / 6 / +c data imach( 3) / 7 / +c data imach( 4) / 6 / +c data imach( 5) / 36 / +c data imach( 6) / 6 / +c data imach( 7) / 2 / +c data imach( 8) / 35 / +c data imach( 9) / o377777777777 / +c data imach(10) / 2 / +c data imach(11) / 27 / +c data imach(12) / -128 / +c data imach(13) / 127 / +c data imach(14) / 60 / +c data imach(15) /-1024 / +c data imach(16) / 1023 / +c +c machine constants for IEEE binary floating point standard +c + data imach( 1) / 5 / + data imach( 2) / 6 / + data imach( 3) / 5 / + data imach( 4) / 6 / + data imach( 5) / 32 / + data imach( 6) / 4 / + data imach( 7) / 2 / + data imach( 8) / 31 / + data imach( 9) / 2147483647 / + data imach(10) / 2 / + data imach(11) / 24 / + data imach(12) / -128 / + data imach(13) / 127 / + data imach(14) / 53 / + data imach(15) / -1023 / + data imach(16) / 1024 / +c +c----------------------------------------------------------------------- +c delete next two statements after supplying the proper data statements. +c data imach (5) /0/ +c if (imach(5) .eq. 0) +c 1call uliber(2,45h i1mach - machine dependent constants not set,45) +c----------------------------------------------------------------------- +c if (i .lt. 1 .or. i .gt. 16) go to 10 +c + i1mach=imach(i) + return +c +c 10 call uliber(1,34h error in i1mach - i out of bounds,34) +c +c stop +c + end diff --git a/unix/portkit/ishift.s.68000 b/unix/portkit/ishift.s.68000 new file mode 100644 index 00000000..cfd6d7e9 --- /dev/null +++ b/unix/portkit/ishift.s.68000 @@ -0,0 +1,44 @@ +|# IAND, IOR, ISHIFT -- Bitwise boolean integer functions for the NCAR +|# package. The shift function must rotate the bits left and around +|# if the nbits to shift argument is positive, and zero fill at the left +|# if the shift is negative (right shift). +|# +|# (SUN/UNIX MC68xxx version) + +|# AND -- Bitwise boolean AND: C = AND (A, B) + .text + .globl _iand_ +_iand_: + movl sp@(4),a0 + movl a0@,d0 + movl sp@(8),a0 + andl a0@,d0 + rts + + +|# OR -- Bitwise boolean OR: C = OR (A, B) + .text + .globl _ior_ +_ior_: + movl sp@(4),a0 + movl a0@,d0 + movl sp@(8),a0 + orl a0@,d0 + rts + + +|# ISHIFT -- Bitwise shift: C = ISHIFT (A, NBITS), +=left + .text + .globl _ishift_ +_ishift_: + movl sp@(4),a0 + movl a0@,d0 + movl sp@(8),a0 + movl a0@,d1 + blt L1 + roll d1,d0 |# left rotate (high bits come in at right) + rts +L1: + negl d1 + lsrl d1,d0 |# logical shift right (zero at left) + rts diff --git a/unix/portkit/mach.h.ieee b/unix/portkit/mach.h.ieee new file mode 100644 index 00000000..f8264d69 --- /dev/null +++ b/unix/portkit/mach.h.ieee @@ -0,0 +1,37 @@ +# Machine Parameters + +define SZB_CHAR 2 # machine bytes per char +define SZB_ADDR 1 # machine bytes per address increment +define SZ_VMPAGE 256 # page size (1 if no virtual mem.) +define MAX_DIGITS 25 # max digits in a number +define NDIGITS_RP 7 # number of digits of real precision +define NDIGITS_DP 17 # number of digits of precision (double) +define MAX_EXPONENT 38 # max exponent, base 10 +define MAX_EXPONENTR 38 +define MAX_EXPONENTD 38 + +define MAX_SHORT 32767 # largest numbers +define MAX_INT 2147483647 +define MAX_LONG 2147483647 +define MAX_REAL 0.99e37 # anything larger is INDEF +define MAX_DOUBLE 0.99e37 +define NBITS_BYTE 8 # nbits in a machine byte +define NBITS_SHORT 16 # nbits in a short +define NBITS_INT 32 # nbits in an integer +define EPSILONR (1.192e-7) # smallest E such that 1.0 + E > 1.0 +define EPSILOND (2.220d-16) # double precision epsilon +define EPSILON EPSILONR + +define INDEFS (-32767) # indefinite valued pixels +define INDEFL (-2147483647) +define INDEFI INDEFL +define INDEFR 1.6e38 +define INDEFD 1.6d38 +define INDEFX (INDEF,INDEF) +define INDEF INDEFR + +# Is byte swapping (i.e., a call to bswap2 or bswap4) needed for a 2 or 4 byte +# MII integer to convert to or from MII format on this machine? + +define BYTE_SWAP2 NO +define BYTE_SWAP4 NO diff --git a/unix/portkit/r1mach.f.ieee b/unix/portkit/r1mach.f.ieee new file mode 100644 index 00000000..c13509fc --- /dev/null +++ b/unix/portkit/r1mach.f.ieee @@ -0,0 +1,191 @@ +c r1mach from portlib 03/25/82 + real function r1mach(i) +c +c single-precision machine constants +c r1mach(1) = b**(emin-1), the smallest positive magnitude. +c +c r1mach(2) = b**emax*(1 - b**(-t)), the largest magnitude. +c +c r1mach(3) = b**(-t), the smallest relative spacing. +c +c r1mach(4) = b**(1-t), the largest relative spacing. +c +c r1mach(5) = log10(b) +c +c to alter this function for a particular environment, +c the desired set of data statements should be activated by +c removing the c from column 1. +c +c where possible, octal or hexadecimal constants have been used +c to specify the constants exactly which has in some cases +c required the use of equivalent integer arrays. +c + integer small(2) + integer large(2) + integer right(2) + integer diver(2) + integer log10(2) +c + real rmach(5) +c + equivalence (rmach(1),small(1)) + equivalence (rmach(2),large(1)) + equivalence (rmach(3),right(1)) + equivalence (rmach(4),diver(1)) + equivalence (rmach(5),log10(1)) +c +c machine constants for the burroughs 1700 system. +c +c data rmach(1) / z400800000 / +c data rmach(2) / z5ffffffff / +c data rmach(3) / z4e9800000 / +c data rmach(4) / z4ea800000 / +c data rmach(5) / z500e730e8 / +c +c machine constants for the burroughs 5700/6700/7700 systems. +c +c data rmach(1) / 01771000000000000 / +c data rmach(2) / o0777777777777777 / +c data rmach(3) / o1311000000000000 / +c data rmach(4) / o1301000000000000 / +c data rmach(5) / o1157163034761675 / +c +c machine constants for the cdc 6000/7000 series. +c +c data rmach(1) / 00014000000000000000b / +c data rmach(2) / 37767777777777777777b / +c data rmach(3) / 16404000000000000000b / +c data rmach(4) / 16414000000000000000b / +c data rmach(5) / 17164642023241175720b / +c +c machine constants for the cray 1 +c +c data rmach(1) / 200004000000000000000b / +c data rmach(2) / 577777777777777777777b / +c data rmach(3) / 377214000000000000000b / +c data rmach(4) / 377224000000000000000b / +c data rmach(5) / 377774642023241175720b / +c +c machine constants for the data general eclipse s/200 +c +c note - it may be appropriate to include the following card - +c static rmach(5) +c +c data small/20k,0/,large/77777k,177777k/ +c data right/35420k,0/,diver/36020k,0/ +c data log10/40423k,42023k/ +c +c machine constants for the harris 220 +c +c data small(1),small(2) / "20000000, "00000201 / +c data large(1),large(2) / "37777777, "00000177 / +c data right(1),right(2) / "20000000, "00000352 / +c data diver(1),diver(2) / "20000000, "00000353 / +c data log10(1),log10(2) / "23210115, "00000377 / +c +c machine constants for the honeywell 600/6000 series. +c +c data rmach(1) / o402400000000 / +c data rmach(2) / o376777777777 / +c data rmach(3) / o714400000000 / +c data rmach(4) / o716400000000 / +c data rmach(5) / o776464202324 / +c +c machine constants for the ibm 360/370 series, +c the xerox sigma 5/7/9 and the sel systems 85/86. +c +c data rmach(1) / z00100000 / +c data rmach(2) / z7fffffff / +c data rmach(3) / z3b100000 / +c data rmach(4) / z3c100000 / +c data rmach(5) / z41134413 / +c +c machine constants for the pdp-10 (ka or ki processor). +c +c data rmach(1) / "000400000000 / +c data rmach(2) / "377777777777 / +c data rmach(3) / "146400000000 / +c data rmach(4) / "147400000000 / +c data rmach(5) / "177464202324 / +c +c machine constants for pdp-11 fortran"s supporting +c 32-bit integers (expressed in integer and octal). +c +c KPNO -- Hex machine constants for the VAX, which stores the bytes of +c a real variable in a funny order. +c +c No standard hex constants in fortran!!! +c data small(1) / x'00000080' / +c data large(1) / x'ffff7fff' / +c data right(1) / x'00003480' / +c data diver(1) / x'00003500' / +c data log10(1) / x'209b359a' / +c +c data small(1) / 128 / +c data large(1) / -32769 / +c data right(1) / 13440 / +c data diver(1) / 13696 / +c data log10(1) / 547042714 / +c +c data small(1) / 8388608 / +c data large(1) / 2147483647 / +c data right(1) / 880803840 / +c data diver(1) / 889192448 / +c data log10(1) / 1067065499 / +c +c data rmach(1) / o00040000000 / +c data rmach(2) / o17777777777 / +c data rmach(3) / o06440000000 / +c data rmach(4) / o06500000000 / +c data rmach(5) / o07746420233 / +c +c machine constants for pdp-11 fortran"s supporting +c 16-bit integers (expressed in integer and octal). +c +c data small(1),small(2) / 128, 0 / +c data large(1),large(2) / 32767, -1 / +c data right(1),right(2) / 13440, 0 / +c data diver(1),diver(2) / 13568, 0 / +c data log10(1),log10(2) / 16282, 8347 / +c +c data small(1),small(2) / o000200, o000000 / +c data large(1),large(2) / o077777, o177777 / +c data right(1),right(2) / o032200, o000000 / +c data diver(1),diver(2) / o032400, o000000 / +c data log10(1),log10(2) / o037632, o020233 / +c +c machine constants for the univac 1100 series. +c +c data rmach(1) / o000400000000 / +c data rmach(2) / o377777777777 / +c data rmach(3) / o146400000000 / +c data rmach(4) / o147400000000 / +c data rmach(5) / o177464202324 / +c +c machine constants for IEEE single precision floating point on 68000. +c +c data small(1) / x'100000' / +c data large(1) / x'7EFFFFFF' / +c data right(1) / x'33800000' / +c data diver(1) / x'34000000' / +c data log10(1) / x'3F317218' / +c + data small(1) / 1048576 / + data large(1) / 2130706431 / + data right(1) / 864026624 / + data diver(1) / 872415232 / + data log10(1) / 1060205080 / +c +c----------------------------------------------------------------------- +c delete next two statements after supplying the proper data statements. +c data rmach(5) /0./ +c if (rmach(5) .eq. 0.0) +c 1call uliber(2,45h r1mach - machine dependent constants not set,45) +c----------------------------------------------------------------------- +c if (i .lt. 1 .or. i .gt. 5) +c 1 call uliber (1,34h error in r1mach - i out of bounds,34) +c + r1mach = rmach(i) + return +c + end diff --git a/unix/portkit/spp.h.ieee b/unix/portkit/spp.h.ieee new file mode 100644 index 00000000..c5fd2309 --- /dev/null +++ b/unix/portkit/spp.h.ieee @@ -0,0 +1,139 @@ +/* + * SPP.H -- Language definitions for interfacing SPP to C and C to UNIX. + * Note that many of the definitions must agree with those in the SPP + * compiler and with and . + */ + +/* Assorted machine constants. [MACHDEP] + * Use osb$zzeps.f to compute the machine epsilon. + */ +#define OSOK 0 /* normal successful completion */ +#define LEN_JUMPBUF 16 /* save buffer for ZSVJMP/ZDOJMP */ +#define EPSILON (1.192e-7) /* smallest real E s.t. (1.0+E > 1.0) */ +#define EPSILOND (2.220d-16) /* double precision epsilon */ +#define MAX_LONG 2147483647 +#define FNNODE_CHAR '!' /* node name delimiter character */ + +/* Indefinite valued numbers. (potentially MACHDEP) + */ +#define INDEFS (-32767) +#define INDEFL (0x80000001) +#define INDEFI INDEFL +#define INDEFR 1.6e38 +#define INDEFD 1.6e38 +#define INDEFX (INDEF,INDEF) +#define INDEF INDEFR + + +/* Oft used constants. + */ +#define SZ_LINE 161 +#define SZ_FNAME 63 +#define SZ_PATHNAME 127 +#define EOS '\0' +#define ERR (-1) +#define OK 0 +#define YES 1 +#define NO 0 +#define MAX_DIGITS 25 +#define min(a,b) (((a)<(b))?(a):(b)) +#define max(a,b) (((a)>(b))?(a):(b)) + +# ifndef NULL +#define NULL 0 +# endif + +# ifndef EOF +#define EOF (-1) +#endif + +/* SPP constants. + */ +#define XEOS 0 +#define XERR (-1) +#define XEOF (-2) +#define XBOF (-3) +#define XOK 0 +#define XNO 0 +#define XYES 1 + +#define BOFL (-3L) +#define EOFL (-2L) + +/* SPP datatypes. (potentially MACHDEP) + */ +# ifndef XCHAR +#define XCHAR short +# endif + +# ifndef XINT +#define XINT int +# endif + +#define PKCHAR XCHAR +#define XUBYTE unsigned char +#define XBOOL int +#define XSHORT short +#define XUSHORT unsigned short +#define XLONG long +#define XREAL float +#define XDOUBLE double +#define XCOMPLEX struct cplx +#define XSTRUCT int +#define XPOINTER int + +struct cplx { + float r; + float i; +}; + +#define TY_BOOL 1 /* SPP datatype codes */ +#define TY_CHAR 2 +#define TY_SHORT 3 +#define TY_INT 4 +#define TY_LONG 5 +#define TY_REAL 6 +#define TY_DOUBLE 7 +#define TY_COMPLEX 8 +#define TY_STRUCT 9 +#define TY_POINTER 10 + + +/* File I/O constants. + */ +#define READ_ONLY 1 /* file access modes */ +#define READ_WRITE 2 +#define WRITE_ONLY 3 +#define APPEND 4 +#define NEW_FILE 5 + +#define TEXT_FILE 11 /* file types */ +#define BINARY_FILE 12 +#define DIRECTORY_FILE 13 + +#define CLIN 1 +#define CLOUT 2 +#define STDIN 3 +#define STDOUT 4 +#define STDERR 5 +#define STDGRAPH 6 +#define STDIMAGE 7 +#define STDPLOT 8 +#define PSIOCTRL 9 + +/* Filename Mapping definitions. + */ + +#define VFN_READ 1 /* VFN access modes for VFNOPEN */ +#define VFN_WRITE 2 +#define VFN_UNMAP 3 + +#define VFN_NOUPDATE 0 /* update flag for VFNCLOSE */ +#define VFN_UPDATE 1 + +/* Oft referenced functions. + */ +XCHAR *c_sppstr(); +XCHAR *c_strupk(); +char *c_strpak(); +#define D_spp diff --git a/unix/portkit/zsvjmp.s.68000 b/unix/portkit/zsvjmp.s.68000 new file mode 100644 index 00000000..efebe43e --- /dev/null +++ b/unix/portkit/zsvjmp.s.68000 @@ -0,0 +1,37 @@ +|# ZSVJMP, ZDOJMP -- Set up a jump (non-local goto) by saving the processor +|# registers in the buffer jmpbuf. A subsequent call to ZDOJMP restores +|# the registers, effecting a call in the context of the procedure which +|# originally called ZSVJMP, but with the new status code. These are Fortran +|# callable procedures. +|# +|# (SUN/UNIX MC68xxx version) + + .text + .globl _zsvjmp_ + + |# The following has nothing to do with ZSVJMP, and is included here + |# only because this assembler module is loaded with every process. + |# This code sets the value of the symbol MEM (the Mem common) to zero, + |# setting the origin for IRAF pointers to zero rather than some + |# arbitrary value, and ensuring that the MEM common is aligned for + |# all datatypes as well as page aligned. A further advantage is that + |# references to NULL pointers will cause a memory violation. + + .globl _mem_ + _mem_ = 0 + + JMPBUF = 4 + STATUS = 8 + + |# The strategy here is to build on the services provided by the C + |# setjmp/longjmp. Note that we cannot do this by writing a C function + |# which calls setjmp, because the procedure which calls setjmp cannot + |# return before the longjmp is executed. + +_zsvjmp_: |# CALL ZSVJMP (JMPBUF, STATUS) + movl sp@(JMPBUF),a0 |# set A0 to point to jmp_buf + movl sp@(STATUS),a1 |# A1 = status variable + movl a1,a0@ |# JB[0] = addr of status variable + clrl a1@ |# return zero status + addql #4,sp@(JMPBUF) |# skip first cell of jmp_buf + jmp _setjmp |# let setjmp do the rest. diff --git a/unix/portkit/zsvjmp.s.FX b/unix/portkit/zsvjmp.s.FX new file mode 100644 index 00000000..1f15102e --- /dev/null +++ b/unix/portkit/zsvjmp.s.FX @@ -0,0 +1,49 @@ +|# ZSVJMP, ZDOJMP -- Set up a jump (non-local goto) by saving the processor +|# registers in the buffer jmpbuf. A subsequent call to ZDOJMP restores +|# the registers, effecting a call in the context of the procedure which +|# originally called ZSVJMP, but with the new status code. These are Fortran +|# callable procedures. +|# +|# (Alliant/UNIX MC68xxx version) + + .text + .globl _zsvjmp_ + .globl _zdojmp_ + + |# The following has nothing to do with ZSVJMP, and is included here + |# only because this assembler module is loaded with every process. + |# This code sets the value of the symbol MEM (the Mem common) to zero, + |# setting the origin for IRAF pointers to zero rather than some + |# arbitrary value, and ensuring that the MEM common is aligned for + |# all datatypes as well as page aligned. A further advantage is that + |# references to NULL pointers will cause a memory violation. + + .globl _mem_ + _mem_ = 0 + +_zsvjmp_: |# call zsvjmp (jmpbuf, status) + movl a0@(4), sp@- |# save pointer to status variable + movl a0@, sp@- |# save pointer to jmpbuf + + movl a0@, sp@- |# call alliant setcontext proc + movl sp, a0 + pea 1 + jsr _setcontext + addql #8, sp + + movl sp@+, a0 |# A0 = &jmpbuf + movl sp@+, a1 |# A1 = &status + + movl a1, a0@(2240) |# save &status in jmpbuf + clrl a1@ |# set status to zero + lea sp@(4), a1 + movl a1, a0@(68) + movl sp@, a0@(74) + rts + +_zdojmp_: + movl a0@, a1 |# A1 = &jmpbuf + movl a1@(2240), a2 |# A2 = &status + movl a0@(4), a3 |# pointer to status value + movl a3@, a2@ |# set status value + jsr _resetcontext diff --git a/unix/portkit/zsvjmp.s.HP800 b/unix/portkit/zsvjmp.s.HP800 new file mode 100644 index 00000000..ce98ff19 --- /dev/null +++ b/unix/portkit/zsvjmp.s.HP800 @@ -0,0 +1,48 @@ +; ZSVJMP.S -- Routine written by Jim Dillon of HP Software Evaluation and +; Migration Center, Cupertino, CA, 2/3/88. +; +mem + .BLOCK 0 + .ALIGN 8 + .IMPORT mem,DATA + .EXPORT mem +; + .code +; +; This routine calls setjmp without the allocation of a +; stack frame for the calling routine, ie zsvjmp. This allows +; the zsvjmp routine to be part of the iraf kernel and +; be functionally equivalent to versions of zsvjmp under other +; host systems. +; +; +; savejump(jmpbuf, status) +; jmp_buf jmpbuf; +; int status; +; saves the caller's jump-buf, not yours; +; we may be called from Fortran. + + .proc + .import setjmp + .export zsvjmp + .callinfo +zsvjmp +; +; save address to status word in jmp_buf[0] +; + stw arg1,0(0,arg0) + ldi 0,1 + stws 1,0(0,arg1) +; +; call setjmp with jmp_buf[1]..jmp_buf[51] +; + addi 4,arg0,arg0 + b setjmp + nop +; +; setjmp will return directly to the caller of zsvjmp at this +; point, so the next statement will never be reached. +; + nop + .procend +; diff --git a/unix/portkit/zsvjmp.s.ISI b/unix/portkit/zsvjmp.s.ISI new file mode 100644 index 00000000..0e7de609 --- /dev/null +++ b/unix/portkit/zsvjmp.s.ISI @@ -0,0 +1,52 @@ +/* + * ZSVJMP, ZDOJMP -- Set up a jump (non-local goto) by saving the processor + * registers in the buffer jmpbuf. A subsequent call to ZDOJMP restores + * the registers, effecting a call in the context of the procedure which + * originally called ZSVJMP, but with the new status code. These are Fortran + * callable procedures. + * + * (ISI/UNIX version for the MC68000) + */ + + .text + .globl _zsvjmp_ + .globl _zdojmp_ + + /* The following has nothing to do with ZSVJMP, and is included here + * only because this assembler module is loaded with every process. + * This code sets the value of the symbol MEM (the Mem common) to zero, + * setting the origin for IRAF pointers to zero rather than some + * arbitrary value, and ensuring that the MEM common is aligned for + * all datatypes as well as page aligned. A further advantage is that + * references to NULL pointers will cause a memory violation. + */ + + .globl _mem_ + .set _mem_, 0 + + .set JMPBUF, 4 + .set STATUS, 8 + .set REGMASK, 0xfcfc /* D2-D7,A2-A5,A6,A7=sp */ + +_zsvjmp_: + movl sp@(JMPBUF),a0 /* set A0 to point to jmpbuf */ + movl sp@(STATUS),a1 /* A1 = status variable */ + movl a1,a0@ /* JB[1] = addr of status variable */ + clrl a1@ /* status = 0 */ + movl sp@+,a1 /* A1 = return address */ + movl a1,a0@(4) /* JB[3] = return address for longjmp */ + moveml #REGMASK,a0@(8) /* save register */ + jmp a1@ /* return from subroutine */ + +_zdojmp_: + movl sp@(STATUS),a0 + movl a0@,d0 /* D0 = status value */ + bne L1 /* branch if not equal to zero */ + moveq #1,d0 /* status must be nonzero */ +L1: + movl sp@(JMPBUF),a0 /* set A0 to point to jmpbuf */ + movl a0@,a1 /* get addr of zsvjmp status variable */ + movl d0,a1@ /* set the status value */ + moveml a0@(8),#REGMASK /* restore registers */ + movl a0@(4),a1 /* get return address of zsvjmp */ + jmp a1@ /* return from zsvjmp */ diff --git a/unix/portkit/zsvjmp.s.SPARC b/unix/portkit/zsvjmp.s.SPARC new file mode 100644 index 00000000..7f6bb7eb --- /dev/null +++ b/unix/portkit/zsvjmp.s.SPARC @@ -0,0 +1,59 @@ +!# ZSVJMP, ZDOJMP -- Set up a jump (non-local goto) by saving the processor +!# registers in the buffer jmpbuf. A subsequent call to ZDOJMP restores +!# the registers, effecting a call in the context of the procedure which +!# originally called ZSVJMP, but with the new status code. These are Fortran +!# callable procedures. +!# +!# (SUN/UNIX sparc version) + + .seg "text" + .global _zsvjmp_ + .global _zdojmp_ + + !# The following has nothing to do with ZSVJMP, and is included here + !# only because this assembler module is loaded with every process. + !# This code sets the value of the symbol MEM (the Mem common) to zero, + !# setting the origin for IRAF pointers to zero rather than some + !# arbitrary value, and ensuring that the MEM common is aligned for + !# all datatypes as well as page aligned. A further advantage is that + !# references to NULL pointers will cause a memory violation. + + .global _mem_ + _mem_ = 0 + + !# The following requires a jmpbuf of length at least 6 ints. + .proc 0 +_zsvjmp_: + save %sp, -0x60, %sp + call _sigblock + clr %o0 + st %o0, [%i0 + 0x8] + st %i1, [%i0 + 0x14] + clr %o0 + st %o0, [%i1] + st %i7, [%i0] + st %fp, [%i0 + 0x4] + add %i0, 0xc, %o1 + call _sigstack + clr %o0 + ret + restore %g0, 0x0, %o0 + + .proc 0 +_zdojmp_: + save %sp, -0x40, %sp + ta 0x3 + ld [%i0 + 0x4], %fp + sub %fp, 0x60, %sp + call _sigsetmask + ld [%i0 + 0x8], %o0 + add %i0, 0xc, %o0 + call _sigstack + clr %o1 + ld [%i0 + 0x14], %o0 + ld [%i1], %i1 + st %i1, [%o0] + ld [%i0], %i7 + ret + restore %i1, 0x0, %o0 + .seg "data" -- cgit