# #include #include #include #include #include #define ERROR -1 #define READ 0 /* parameters for system i/o calls */ #define WRITE 1 #define READWRIT 2 #define STDPERM 0666 #define PPERM 0644 #define MASK8 0377 #define MASK7 0177 #define MASK6 077 /* home made flags */ #define CHAR 0 #define INT 1 #define FLOAT 2 #define DOUBLE 3 #define OPTIONS 0 #define FILEPARM 1 #define PARAM 2 #define NO 0 #define YES 1 #define TRUE 1 #define FALSE 0 /* math constants */ #define PI 3.141592654 #define PI180 0.0174533 /* macros to rename cvl routines */ #define make_header(A,B,C) mhead(A,B,C) #define length_argv(A) lnargv(A) #define input_header(F,H) ihead(F,H) #define output_header(A,B) ohead(A,B) #define copy_ptr_header(A,B) cphead(A,B) #define copy_cmnts(A,B,C) cpcmnt(A,B,C) #define copy_file_header(A,B,C,D) outhd(A,B,C,D) #define multiple_cmnt_copy(A,B,C,D) mcpcmt(A,B,C,D) #define output_argv_cmnt(A,B) prargv(A,B) /* misc macros */ #define abs(A) ( ( (A) >= 0) ? (A) : -(A) ) #define max(A,B) ( ( (A) > (B)) ? (A) : (B) ) #define min(A,B) ( ( (A) < (B)) ? (A) : (B) ) #define sgn(A) ( ( (A) >= 0) ? 1 : -1 ) #define fdiv(A,B) ( ( (B) == 0) ? 0 : (A)/(B) ) #define sqr(A) ( (A) * (A) ) /* math routines */ double sqrt(); /* imagein.c routines - input image to program */ int open_image(); /* (char *file_name_buf) */ /* returns file descriptor */ struct cvl_p *get_header(); /* (int filedescriptor) */ /* returns image header */ int check_header(); /* (cvl_p *header, int n_rows,n_cols,pixsize) */ /* returns nothing */ int dump_cmnts(); /* (int filedes, cvl_p *header) */ /* returns nothing */ char **alloc_image(); /* (int n_rows,n_cols,pixel_size) */ /* returns ptr to new storage(must be cast) */ int read_image(); /* (int filedes,unchar array,int cols,rows,type*/ /* returns nothing */ /* paramin.c routines - input parameters to programs */ char *get_parameter(); /* (FILE *filedes,char *buf,int type,which) */ /* returns string address */ /* string.c routines - nondestructive string handling */ int contains(); /* (string,char) */ /* lprout.c routines - output formatting routines */ int printul(); /* (int indentation,int number_of_underlines) */ /* yet more routines */ char *namespace(); /* (char *filename) */ /* returns char storage of same length as filename */ int open_suffix(); /* (char *fileroot,*suffix) */ /* returns file descriptor of file named rootsuffix */ FILE *fopen_suffix(); /* (char *fileroot,*suffix) */ /* returns file descriptor of file named rootsuffix */