home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1997 #2 / amigaacscoverdisc / utilities / shareware / music / gfft-2.03 / source / gfft-2.03-source.lha / gfft.h < prev    next >
C/C++ Source or Header  |  1996-01-02  |  4KB  |  172 lines

  1. /***************************************************************************
  2.  *          Copyright (C) 1994  Charles P. Peterson                  *
  3.  *         4007 Enchanted Sun, San Antonio, Texas 78244-1254             *
  4.  *              Email: Charles_P_Peterson@fcircus.sat.tx.us                *
  5.  *                                                                         *
  6.  *          This is free software with NO WARRANTY.                  *
  7.  *          See gfft.c, or run program itself, for details.              *
  8.  *              Support is available for a fee.                      *
  9.  ***************************************************************************
  10.  *
  11.  * Program:     gfft--General FFT analysis
  12.  * File:        gfft.h
  13.  * Purpose:     general include file for gfft
  14.  * Author:      Charles Peterson (CPP)
  15.  * History:     29-May-1993 CPP; Created.
  16.  *               6-July-1994 CPP (0.74); Decreased command buffer size
  17.  *               7-Jan-1995 CPP (1.19); Moved settings.h types here for port
  18.  */
  19.  
  20. #ifndef GFFT_H
  21. #define GFFT_H
  22.  
  23. /*
  24.  * Semi-permanent compilation options should be put here
  25.  */
  26.  
  27.  
  28. #include <setjmp.h>    /* jmp_buf  */
  29. #include "defxtern.h"
  30.  
  31. #ifdef AMIGA
  32. #include  "amigadef.h"
  33. #endif
  34.  
  35. #ifdef UNIX
  36. #include  "unixdef.h"
  37. #endif
  38.  
  39. #ifdef __MSDOS__
  40. #include "msdosdef.h"
  41. #endif
  42.  
  43.  
  44. /*
  45. * Terminations
  46. */
  47. #define CLOSEDINPUT 0   /* OK for now */
  48.  
  49. /*
  50.  * Sizes
  51.  */
  52. #define COMMAND_BUFFER_SIZE 512
  53. #define MAX_PATH 256
  54. #define MESSAGE_IOBUFFER_SIZE 256
  55.  
  56. /*
  57.  * Etc.
  58.  */
  59. #define PROMPT "gfft> "
  60.  
  61. #ifndef EXIT_SUCCESS
  62. #define EXIT_SUCCESS 0
  63. #endif
  64.  
  65. #ifndef EXIT_FAILURE
  66. #define EXIT_FAILURE 100
  67. #endif
  68.  
  69. /*
  70.  * Define TRUE, FALSE, and NULL undefining first if already defined
  71.  */
  72.  
  73. #ifdef TRUE
  74. #undef TRUE
  75. #endif
  76. #define TRUE 1
  77.  
  78. #ifdef FALSE
  79. #undef FALSE
  80. #endif
  81. #define FALSE 0
  82.  
  83. #ifdef NULL
  84. #undef NULL
  85. #endif
  86. #define NULL 0
  87.  
  88.  
  89. /*
  90.  * Codes
  91.  * 
  92.  */
  93. #define NOTHING_SPECIAL 0  /* Nothing special to do after longjmp */
  94. #define WORKBENCH_MODE 0
  95. #define INTERACTIVE_MODE 1
  96. #define BATCH_MODE 2
  97.  
  98. #define NEXT_FILE 3
  99.  
  100. /*
  101.  * typedefs and types
  102.  */
  103. typedef struct {
  104.     char* full_string;
  105.     char* min_string;
  106.     char *(*cfunction)(char *arguments);
  107. } Name_Info_St;
  108.  
  109. typedef struct
  110. {
  111. unsigned long zero;
  112. int bits;
  113. BOOLEAN binary;        /* Ascii otherwise */
  114. }
  115. IOFormatS;
  116.  
  117. struct cal_st
  118.     struct cal_st *next;
  119.     char *filename;
  120.     long size;
  121.     BOOLEAN db;
  122.     double *frequencies;
  123.     float *amplitudes;
  124.  
  125.     long index;  /* 'instance' variable */
  126. };
  127.  
  128. struct list_st {
  129. void *node;
  130. struct list_st *next;
  131. };
  132.  
  133. #define BIN_TYPE float
  134. #define FINAL_TYPE float   /* Used in final normalizations, etc. */
  135.  
  136.  
  137. /*
  138.  * Global variables
  139.  */
  140. DEFXTERNU(jmp_buf,SaveJmpBuf[50])
  141. DEFXTERN(jmp_buf,*JmpBufp,SaveJmpBuf)   /* We use this (for indirection) */
  142. DEFXTERN(float,*Save_Data,0)
  143. DEFXTERN(int,CommandMode,INTERACTIVE_MODE)
  144. DEFXTERN(char,Command[COMMAND_BUFFER_SIZE],{'\0'})
  145. DEFXTERN(int,Error_Count,0)
  146. DEFXTERN(int,Interrupt_Count, 0)
  147. DEFXTERN(char,*NullString,"\0")
  148. DEFXTERN(double,Sample_Sum_Of_Squares, 0.0)
  149. DEFXTERN(long,Sample_Frame_Count, 0)
  150.  
  151. /*
  152.  * Macros
  153.  */
  154. #define CATCH_ERROR     if (0 == setjmp (*++JmpBufp)) {
  155. #define ON_ERROR        } else {
  156. #define END_CATCH_ERROR } --JmpBufp;
  157. #define RAISE_ERROR(HANDLING) longjmp (*JmpBufp,(HANDLING));
  158.  
  159. /*
  160.  * Note: there is a little cheating here.
  161.  * If either of the following is modified, you must be sure to touch
  162.  * all dependent codes.  Or touch gfft.h to be certain.
  163.  * Otherwise, you're dead!
  164.  */
  165.  
  166. #include "errcodes.h" /* Define all error codes */
  167.  
  168. #include "gproto.h"   /* Define all prototypes */
  169.  
  170. #endif /* ifndef GFFT_H */
  171.