Mercurial > hg > audiostuff
comparison intercom/g711/ugstdemo.h @ 2:13be24d74cd2
import intercom-0.4.1
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Fri, 25 Jun 2010 09:57:52 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:9cadc470e3da | 2:13be24d74cd2 |
|---|---|
| 1 /* ------------------------------------------------------------------------- */ | |
| 2 /* File: UGSTDEMO.H version 2.2 22-Jan-1999 (18:00) */ | |
| 3 /* ------------------------------------------------------------------------- */ | |
| 4 /* Definitions for UGST demo programs */ | |
| 5 /* ------------------------------------------------------------------------- */ | |
| 6 #ifndef UGSTDEMO_defined | |
| 7 #define UGSTDEMO_defined 220 | |
| 8 | |
| 9 /* DEFINITION FOR OPERATING SYSTEMS */ | |
| 10 | |
| 11 #ifndef MSDOS | |
| 12 #if defined(__MSDOS__) || defined (__CYGWIN__) || defined (_MSC_VER) | |
| 13 # define MSDOS | |
| 14 #endif | |
| 15 #endif | |
| 16 | |
| 17 #if defined(VMS) | |
| 18 # if defined(__GNUC__) | |
| 19 # define COMPILER "GCC-VMS" | |
| 20 # else | |
| 21 # define COMPILER "VaxC-VMS" | |
| 22 # endif | |
| 23 #elif defined (__CYGWIN__) | |
| 24 # define COMPILER "GCC/CYGWIN-Win32" | |
| 25 #elif defined (_MSC_VER) | |
| 26 # define COMPILER "Microsoft Visual C-Win32" | |
| 27 #elif defined (__TURBOC__) | |
| 28 # define COMPILER "Borland Turbo-C-Win16" | |
| 29 #elif defined (__BORLANDC__) | |
| 30 # define COMPILER "Borland-C-Win16" | |
| 31 #elif defined(__GNUC__) && defined(MSDOS) | |
| 32 # define COMPILER "GCC/DJGPP-Win16" | |
| 33 #elif defined(__hpux) | |
| 34 # if defined(__GNUC__) | |
| 35 # define COMPILER "GCC-HPUX" | |
| 36 # else | |
| 37 # define COMPILER "Unknown compiler/HPUX" | |
| 38 # endif | |
| 39 #elif defined(sun) | |
| 40 # if defined(__GNUC__) | |
| 41 # define COMPILER "GCC-Sun" | |
| 42 # elif !defined (__unix__) | |
| 43 # define COMPILER "CC-Sun" | |
| 44 # else | |
| 45 # define COMPILER "ACC-SUN" | |
| 46 # endif | |
| 47 #elif defined(__alpha) | |
| 48 # define COMPILER "DecC-Alpha" | |
| 49 #elif defined(__GNUC__) | |
| 50 # define COMPILER "GCC-Unknown platform" | |
| 51 #else | |
| 52 # define COMPILER "Unknown compiler/Platform" | |
| 53 #endif | |
| 54 | |
| 55 /* DEFINITION FOR MEASURING CPU-TIME CONSUMPTION */ | |
| 56 | |
| 57 #include <time.h> | |
| 58 | |
| 59 #ifndef CLOCKS_PER_SEC | |
| 60 #if defined(__TURBOC__)|defined(VMS) /* For Borland and Vax C compilers */ | |
| 61 #define CLOCKS_PER_SEC CLK_TCK | |
| 62 #elif defined(MSDOS) /* Only for Microsoft C compilers */ | |
| 63 #define CLOCKS_PER_SEC 1 | |
| 64 #else /* Unix */ | |
| 65 #define CLOCKS_PER_SEC 1000000 | |
| 66 #endif /* if */ | |
| 67 #endif /* ifndef */ | |
| 68 | |
| 69 /* DEFINITION FOR SMART PROTOTYPES */ | |
| 70 #ifndef ARGS | |
| 71 #if defined(MSDOS) || defined(__STDC__) || defined(VMS) || defined(__DECC) | |
| 72 #define ARGS(x) x | |
| 73 #else /* Unix: no parameters in prototype! */ | |
| 74 #define ARGS(x) () | |
| 75 #endif | |
| 76 #endif | |
| 77 | |
| 78 | |
| 79 /* | |
| 80 ----------------------------------------------------------------------- | |
| 81 DEFINITIONS FOR COMAND LINE INPUT OF PARAMETERS | |
| 82 ----------------------------------------------------------------------- | |
| 83 Asking User for Parameter Input | |
| 84 ------------------------------------------------------------------------ | |
| 85 if the desired parameter has not been entered, the user is asked | |
| 86 for this with a prompt string; otherwise the same prompt string is | |
| 87 printed to the screen, followed by the value read for the parameter | |
| 88 -------------------------------------------------------------------------- | |
| 89 */ | |
| 90 | |
| 91 #define askc(m,v) {\ | |
| 92 fprintf(stderr,m); \ | |
| 93 scanf("%1s%*c",&v); \ | |
| 94 v=toupper(v);} | |
| 95 | |
| 96 #define asks(m,v) {\ | |
| 97 fprintf(stderr,m); \ | |
| 98 scanf("%s",v);} | |
| 99 | |
| 100 #define askl(m,v) {\ | |
| 101 fprintf(stderr,m);\ | |
| 102 scanf("%ld",&v);} | |
| 103 | |
| 104 #define asklu(m,v) {\ | |
| 105 fprintf(stderr,m);\ | |
| 106 scanf("%lu",&v);} | |
| 107 | |
| 108 #define askf(m,v) {\ | |
| 109 fprintf(stderr,m);\ | |
| 110 scanf("%f",&v);} | |
| 111 | |
| 112 #define asklf(m,v) {\ | |
| 113 fprintf(stderr,m);\ | |
| 114 scanf("%lf",&v);} | |
| 115 | |
| 116 #define aski(m,v) {\ | |
| 117 fprintf(stderr,m);\ | |
| 118 scanf("%d",&v);} | |
| 119 | |
| 120 #define GET_PAR_L(p,msg,i ) \ | |
| 121 { if(argc>p) { \ | |
| 122 i=atol(argv[p]); \ | |
| 123 fprintf(stderr,"%s%ld\n",msg,i);}\ | |
| 124 else askl(msg,i);} | |
| 125 | |
| 126 #define GET_PAR_LU(p,msg,i ) \ | |
| 127 { if(argc>p) { \ | |
| 128 sscanf(argv[p],"%ul",&(i)); \ | |
| 129 fprintf(stderr,"%s%lu\n",msg,i);}\ | |
| 130 else asklu(msg,i);} | |
| 131 | |
| 132 #define GET_PAR_I(p,msg,i ) \ | |
| 133 { if(argc>p) { \ | |
| 134 i=atoi(argv[p]); \ | |
| 135 fprintf(stderr,"%s%d\n",msg,i);}\ | |
| 136 else aski(msg,i);} | |
| 137 | |
| 138 #define GET_PAR_D(p,msg,r ) \ | |
| 139 { if(argc>p) {\ | |
| 140 r=(double)atof(argv[p]);\ | |
| 141 fprintf(stderr,"%s%f\n",msg,r);}\ | |
| 142 else asklf(msg,r);} | |
| 143 | |
| 144 #define GET_PAR_F(p,msg,r ) \ | |
| 145 { if(argc>p) {\ | |
| 146 r=atof(argv[p]);\ | |
| 147 fprintf(stderr,"%s%f\n",msg,r);}\ | |
| 148 else askf(msg,r);} | |
| 149 | |
| 150 #define GET_PAR_S(p,msg,sp) \ | |
| 151 { if(argc>p) {\ | |
| 152 strcpy(sp,argv[p]); \ | |
| 153 fprintf(stderr,"%s%s\n",msg,sp);}\ | |
| 154 else asks(msg,sp);} | |
| 155 | |
| 156 #define GET_PAR_C(p,msg,C) \ | |
| 157 { if(argc>p) {\ | |
| 158 C=toupper(argv[p][0]);\ | |
| 159 fprintf(stderr,"%s%c\n",msg,C);}\ | |
| 160 else askc(msg,C);} | |
| 161 | |
| 162 /* | |
| 163 -------------------------------------------------------------------------- | |
| 164 If the desired parameter has not been entered, a default value is | |
| 165 taken; otherwise the entered value is used | |
| 166 -------------------------------------------------------------------------- | |
| 167 */ | |
| 168 #define FIND_PAR_C(p,msg,C,dft) \ | |
| 169 { C=toupper((argc>p)?argv[p][0]:dft);\ | |
| 170 fprintf(stderr,"%s%c\n",msg,C);} | |
| 171 | |
| 172 #define FIND_PAR_S(p,msg,i,dft) \ | |
| 173 { strcpy(i,(argc>p)?argv[p]:dft);\ | |
| 174 fprintf(stderr,"%s%s\n",msg,i); } | |
| 175 | |
| 176 #define FIND_PAR_L(p,msg,i,j) \ | |
| 177 if(argc>p) {\ | |
| 178 i=atol(argv[p]);\ | |
| 179 fprintf(stderr,"%s%ld\n",msg,i); }\ | |
| 180 else {\ | |
| 181 i=j; \ | |
| 182 fprintf(stderr,"%s%ld\n",msg,i); } | |
| 183 | |
| 184 #define FIND_PAR_I(p,msg,i,j) \ | |
| 185 if(argc>p) {\ | |
| 186 i=atoi(argv[p]);\ | |
| 187 fprintf(stderr,"%s%d\n",msg,i); }\ | |
| 188 else {\ | |
| 189 i=(int)j; \ | |
| 190 fprintf(stderr,"%s%d\n",msg,i); } | |
| 191 | |
| 192 #define FIND_PAR_F(p,msg,i,j) \ | |
| 193 if(argc>p) {\ | |
| 194 i=atof(argv[p]);\ | |
| 195 fprintf(stderr,"%s%f\n",msg,i); }\ | |
| 196 else {\ | |
| 197 i=j; \ | |
| 198 fprintf(stderr,"%s%f\n",msg,i); } | |
| 199 | |
| 200 #define FIND_PAR_D(p,msg,i,j) \ | |
| 201 if(argc>p) {\ | |
| 202 i=(double)atof(argv[p]);\ | |
| 203 fprintf(stderr,"%s%f\n",msg,i); }\ | |
| 204 else {\ | |
| 205 i=j; \ | |
| 206 fprintf(stderr,"%s%f\n",msg,i); } | |
| 207 | |
| 208 /* GENERAL DEFINITIONS */ | |
| 209 | |
| 210 /* -------------------------------------------- */ | |
| 211 /* ... Print error message and exit program ... */ | |
| 212 /* -------------------------------------------- */ | |
| 213 #define HARAKIRI(m,code) {fprintf(stderr,m); exit((int)code);} | |
| 214 /* #define KILL(f,code) {perror(f); exit((int)code);} */ | |
| 215 #define KILL(f,code) perror(f), exit((int)code) | |
| 216 | |
| 217 | |
| 218 /* DEFINITIONS FOR OPEN/CLOSE ISSUES */ | |
| 219 | |
| 220 #if defined(VMS) && !defined(__GNUC__) | |
| 221 # define WB "wb",mrs,"rfm=fix","ctx=stm" | |
| 222 # define RB "rb",mrs,"rfm=fix","ctx=stm" | |
| 223 # define WT "w","mrs=256","rat=cr","rfm=var" | |
| 224 # define RT "r","mrs=256","rat=cr","rfm=var" | |
| 225 # define RWT "r+","mrs=256","rat=cr","rfm=var" | |
| 226 #elif defined(MSDOS)|defined(__CYGWIN__) | |
| 227 # define WB "wb" | |
| 228 # define RB "rb" | |
| 229 # define WT "wt" | |
| 230 # define RT "rt" | |
| 231 # define RWT "rt+" | |
| 232 #else /* Unix */ | |
| 233 # define WB "w" | |
| 234 # define RB "r" | |
| 235 # define WT "w" | |
| 236 # define RT "r" | |
| 237 # define RWT "r+" | |
| 238 #endif | |
| 239 | |
| 240 #endif | |
| 241 | |
| 242 /* ................... End of include file UGSTDEMO.H ................... */ |
