#!/bin/sh # This is a shar archive. # The rest of this file is a shell script which will extract: # # abs.h minmax.h swap.h # # To extract the files from this shell archive file simply # create a directory for this file, move the archive file # to it and enter the command # # sh filename # # The files will be extracted automatically. # Note: Do not use csh. # # Archive created: Sat Aug 25 18:06:14 EDT 1990 # echo x - abs.h sed 's/^X//' > abs.h << '!EOF!' // define a function for each of the various // basic types which returns the absolute value. #ifndef ABS_H # define ABS_H overload abs; #define defabs(typex) \ inline typex abs(typex &a) \ { \ if (a >= 0) return a; \ else return -a; \ } defabs(char) defabs(short) defabs(int) defabs(long) defabs(float) defabs(double) #endif /* ABS_H */ !EOF! ls -l abs.h echo x - minmax.h sed 's/^X//' > minmax.h << '!EOF!' // define a function for each of the various // basic types which returns the minimum or // maximum value. #ifndef MINMAX_H # define MINMAX_H overload max; overload min; #define defminmax(typex) \ inline typex &max(typex &a, typex &b) \ { if (a > b) return a; else return b; } \ \ inline typex &min(typex &a, typex &b) \ { if (a < b) return a; else return b; } // all basic types defminmax(char) defminmax(short) defminmax(int) defminmax(long) defminmax(unsigned char) defminmax(unsigned short) defminmax(unsigned int) defminmax(unsigned long) defminmax(float) defminmax(double) // pointers to each basic type defminmax(char *) defminmax(short *) defminmax(int *) defminmax(long *) defminmax(unsigned char *) defminmax(unsigned short *) defminmax(unsigned int *) defminmax(unsigned long *) defminmax(float *) defminmax(double *) #endif /* MINMAX_H */ !EOF! ls -l minmax.h echo x - swap.h sed 's/^X//' > swap.h << '!EOF!' // define a swap function for the various basic types #ifndef SWAPH # define SWAPH overload swap; #define defswap(typex) \ inline void swap(typex &a, typex &b) \ { \ typex tmp = a; \ a = b; \ b = tmp; \ } // all basic types defswap(char) defswap(short) defswap(int) defswap(long) #ifndef NO_UNSIGNED_OVERLOADING defswap(unsigned char) defswap(unsigned short) defswap(unsigned int) defswap(unsigned long) #endif /* NO_UNSIGNED_OVERLOADING */ defswap(float) defswap(double) // pointers to each basic type defswap(char *) defswap(short *) defswap(int *) defswap(long *) defswap(unsigned char *) defswap(unsigned short *) defswap(unsigned int *) defswap(unsigned long *) defswap(float *) defswap(double *) #endif /* SWAPH */ !EOF! ls -l swap.h # The following exit is to ensure that extra garbage # after the end of the shar file will be ignored. exit 0