CCL Home Page
Up Directory CCL utility.h
/*============================================================================*/
/* FILENAME: UTILITY.H
/* PURPOSE: DEFINES AND DECLARATIONS FOR UTILITY LIBRARY ROUTINES.
/* WRITTEN: M.V.GRIESHABER
/* LAST MODIFICATION: 22 JUNE 1993 MVG (ADDED PFIELD)
/*============================================================================*/
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define NULL_ENTRY 1		/* RETURN STATUS; NO CHARACTERS ENTERED. */
#define ABORT_ENTRY 2		/* RETURN STATUS; ABORT CHARACTER ENTERED. */
#define VALID_ENTRY 3		/* RETURN STATUS; SOMETHING VALID ENTERED. */

#define ABORT_CHARACTER '^'	/* CHARACTER ENTERED TO ABORT RESPONSE. */

#define NULL_OK 1		/* FLAG; NULL RESPONSE IS ALLOWED. */
#define NULL_NOT_OK 0		/* FLAG; NULL RESPONSE IS NOT ALLOWED. */

#define RANGE_CHECK 1		/* FLAG; CHECK MIN/MAX NUMBER RANGE. */
#define NO_RANGE_CHECK 0	/* FLAG; NO CHECKING OF NUMBER RANGE. */

#define PROGRAM_SUCCEEDED 0	/* TOP LEVEL EXIT STATUS VALUE. */
#define PROGRAM_FAILED 1	/* TOP LEVEL EXIT STATUS VALUE. */

#define DEGREES_PER_RADIAN 57.2957795147
#define RADIANS_PER_DEGREE  0.0174532925
#define ANGSTROMS_PER_AU 0.529177249
#define AUS_PER_ANGSTROM 1.889725989
#define ANGSTROMS_PER_BOHR ANGSTROMS_PER_AU
#define BOHRS_PER_ANGSTROM AUS_PER_ANGSTROM
#define PI M_PI			/* MORE CONVENTIONAL NAME FOR PI. */

#define TRUE 1
#define FALSE 0

typedef unsigned short USHORT;
typedef unsigned char UCHAR;
typedef unsigned long ULONG;

/* USER INTERACTION ROUTINES. */
extern int gchoice();		/* GET A ONE CHARACTER CHOICE FROM USER. */
extern int gint();		/* GET AN INTEGER FROM USER. */
extern int gdouble();		/* GET A DOUBLE FROM USER. */
extern int gstring();		/* GET A STRING FROM USER. */

/* CONVERSION ROUTINES. */
extern char *upper();		/* UPPERCASE A STRING IN PLACE. */
extern char *lower();		/* LOWERCASE A STRING IN PLACE. */
extern char *nolead();		/* REMOVE LEADING CHARACTERS. */
extern char *notrail();		/* REMOVE TRAILING CHARACTERS. */
extern char *squish_blanks();	/* REMOVE LEAD,TRAIL, MULT BLANK STRINGS. */
extern char *ordinal();		/* CONVERT INT TO ORDINAL STRING. */

/* VALIDATION ROUTINES. */
extern int valchars();		/* VALIDATE CHARACTERS IN A STRING. */
extern int graphics_ok();	/* CHECK GRAPHICS AVAILABILITY. */

/* FILE MANIPULATION ROUTINES. */
extern char *fn_dir();		/* EXTRACT "D1/D2" FROM "D1/D2/ROOT.EXT". */
extern char *fn_root();		/* EXTRACT "ROOT" FROM "D1/D2/ROOT.EXT". */
extern char *fn_ext();		/* EXTRACT ".EXT" FROM "D1/D2/ROOT.EXT". */
extern char *fn_base();		/* EXTRACT "ROOT.EXT" FROM "D1/D2/ROOT.EXT". */	
extern char *new_extension();	/* CHANGE FILE NAME EXTENSION IN PLACE. */
extern FILE *file_opened();	/* OPEN A FILE WITH DEFAULT EXTENSION. */
extern char *find_line();	/* FIND FILE LINE CONTAINING STRING. */
extern int gdata_line();	/* GET A "DATA" LINE FROM A FILE. */
extern void mv_file();		/* MOVE FILE TO TARGET. */
extern void cp_file();		/* COPY FILE TO TARGET. */
extern int lock();		/* SEMAPHORE FILE LOCK (CREATES FILE). */
extern void unlock();		/* SEMAPHORE FILE UNLOCK (UNLINKS FILE). */

/* MISCELLANEOUS UTILITY ROUTINES. */
extern int errmsg();		/* PRINT MESSAGE, GET ACK, RETURN VALUE. */
extern char *find_string();	/* FIND START OF STRING IN LINE. */
extern int count_tokens();	/* COUNT NUMBER OF TOKENS IN LINE. */
extern char *gntoken();		/* GET NUMBERED TOKEN FROM LINE. */
extern char *gfield();		/* GET FIELD FROM LINE. */
extern char *pfield();		/* PUT FIELD ONTO LINE. */
extern char *cmd_head();	/* EXECUTE CMD VIA PIPE, RETURN FIRST LINE. */

/* VECTOR OPERATION ROUTINES. */
extern void vec_diff();		/* COMPUTE DIFFERENCE OF TWO VECTORS. */
extern double vec_length();	/* COMPUTE LENGTH OF VECTOR. */
extern double vec_angle();	/* COMPUTE ANGLE BETWEEN TWO VECTORS. */
extern double vec_dotprod();	/* COMPUTE DOT PRODUCT OF TWO VECTORS. */
extern void vec_crossprod();	/* COMPUTE CROSS PRODUCT OF TWO VECTORS. */
extern double vec_norm();	/* NORMALIZE VECTOR. */

/* MATRIX OPERATION ROUTINES. */
extern void mat_transpose();	/* TRANSPOSE A 3 BY 3 MATRIX. */
extern void mat_multiply();	/* MULTIPLY TWO 3 BY 3 MATRIXES. */
extern void mat_transform();	/* TRANSFORM A VECTOR BY A 4 BY 4 MATRIX. */
Modified: Fri Feb 11 17:00:00 1994 GMT
Page accessed 5633 times since Sat Apr 17 21:59:02 1999 GMT