Main Page   Class Hierarchy   Data Structures   File List   Data Fields   Globals  

cinter.c

Go to the documentation of this file.
00001 
00002 /*
00003  * Copyright (c) 1986,1987,1988,1989,1990,1991,1992,1993,
00004  * by Steve McMillan, Drexel University, Philadelphia, PA.
00005  *
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms are permitted
00009  * provided that the above copyright notice and this paragraph are
00010  * duplicated in all such forms and that any documentation,
00011  * advertising materials, and other materials related to such
00012  * distribution and use acknowledge that the software was developed
00013  * by the author named above.
00014  *
00015  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00016  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00017  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018  */
00019 
00020 /*      CINTER: Interface routines to avoid use of FORTRAN "malloc" */
00021 
00022 /*
00023  *      CREBIN: Intermediate storage allocation routine for rebinning.
00024  */
00025 
00026 #define NULL 0
00027 
00028 void crebin(string,array,nmax,narr,status,prompt,length)
00029 char *string;
00030 float *array;
00031 int *nmax, *narr, *status, *prompt;
00032 long length;
00033 {
00034     float *temp;
00035     int *itemp;
00036 
00037     /* Allocate workspace. */
00038 
00039     if ( (temp = (float *) malloc((*nmax)*sizeof(float))) == NULL) {
00040         printf("Can't allocate workspace for TEMP...\n");
00041         *status = 1;
00042         return;
00043     }
00044 
00045     if ( (itemp = (int *) malloc((*nmax)*sizeof(int))) == NULL) {
00046         printf("Can't allocate workspace for ITEMP...\n");
00047         *status = 2;
00048         return;
00049     }
00050 
00051     /* Call the FORTRAN routine */
00052 
00053     *status = 0;
00054 
00055 #ifdef FORTRAN_TRAILING_UNDERSCORE
00056     rebin_(string,array,nmax,narr,status,prompt,temp,itemp,length);
00057 #else
00058     rebin(string,array,nmax,narr,status,prompt,temp,itemp,length);
00059 #endif
00060 
00061     /* Free workspace. */
00062 
00063     free(temp);
00064     free(itemp);
00065 }
00066 
00067 void crebin_(string,array,nmax,narr,status,prompt,length)
00068 char *string;
00069 float *array;
00070 int *nmax, *narr, *status, *prompt;
00071 long length;
00072 {
00073     crebin(string,array,nmax,narr,status,prompt,length);
00074 }
00075 
00076 /*
00077  *      CAUTOCORREL: Intermediate storage allocation routine for autocorrel.
00078  */
00079 
00080 void cautocorrel(array,nmax)
00081 float *array;
00082 int *nmax;
00083 {
00084     float *temp;
00085 
00086     /* Allocate workspace. */
00087 
00088     if ( (temp = (float *) malloc((1+(*nmax)/2)*sizeof(float))) == NULL) {
00089         printf("Can't allocate workspace for TEMP...\n");
00090         return;
00091     }
00092 
00093     /* Call the FORTRAN routine */
00094 
00095 #ifdef FORTRAN_TRAILING_UNDERSCORE
00096     autocorrel_(array, nmax, temp);
00097 #else
00098     autocorrel(array, nmax, temp);
00099 #endif
00100 
00101     /* Free workspace. */
00102 
00103     free(temp);
00104 }
00105 
00106 void cautocorrel_(array,nmax)
00107 float *array;
00108 int *nmax;
00109 {
00110     cautocorrel(array,nmax);
00111 }

Generated at Sun Feb 24 09:56:55 2002 for STARLAB by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001