3 defs for vector and buffer data structures and utilities
5 This file is part of a program that implements a Software-Defined Radio.
7 Copyright (C) 2004 by Frank Brickle, AB2KT and Bob McGwier, N4HY
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 The authors can be reached by email at
31 The DTTS Microwave Society
41 #include <datatypes.h>
45 typedef struct _complex_buffer_desc {
47 int size, ovlp, want, have, done, mine;
50 /* all these should be OK rhs or lhs */
52 #define CXBbase(p) ((p)->data)
53 #define CXBdata(p, i) (CXBbase(p)[(i)])
54 #define CXBreal(p, i) (CXBbase(p)[(i)].re)
55 #define CXBimag(p, i) (CXBbase(p)[(i)].im)
56 #define CXBsize(p) ((p)->size)
57 #define CXBovlp(p) ((p)->ovlp)
58 #define CXBwant(p) ((p)->want)
59 #define CXBhave(p) ((p)->have)
60 #define CXBdone(p) ((p)->done)
61 #define CXBmine(p) ((p)->mine)
63 typedef struct _real_buffer_desc {
65 int size, ovlp, want, have, done, mine;
68 #define RLBbase(p) ((p)->data)
69 #define RLBdata(p, i) (RLBbase(p)[(i)])
70 #define RLBsize(p) ((p)->size)
71 #define RLBovlp(p) ((p)->ovlp)
72 #define RLBwant(p) ((p)->want)
73 #define RLBhave(p) ((p)->have)
74 #define RLBdone(p) ((p)->done)
75 #define RLBmine(p) ((p)->mine)
77 extern char *safealloc(int count, int nbytes, char *tag);
78 extern void safefree(char *p);
79 extern REAL *newvec_REAL(int size, char *tag);
80 extern void delvec_REAL(REAL *vec);
81 extern IMAG *newvec_IMAG(int size, char *tag);
82 extern void delvec_IMAG(IMAG *vec);
83 extern COMPLEX *newvec_COMPLEX(int size, char *tag);
84 extern void delvec_COMPLEX(COMPLEX *buf);
85 extern void dump_REAL(FILE *fp, char *head, REAL *ptr, int beg, int fin);
86 extern void dump_IMAG(FILE *fp, char *head, IMAG *ptr, int beg, int fin);
87 extern void dump_CX(FILE *fp, char *head, COMPLEX *ptr, int beg, int fin);
89 extern CXB newCXB(int size, COMPLEX *base, char *tag);
90 extern void delCXB(CXB p);
92 extern RLB newRLB(int size, REAL *base, char *tag);
93 extern void delRLB(RLB p);
95 extern REAL normalize_vec_REAL(REAL *, int);
96 extern REAL normalize_vec_COMPLEX(COMPLEX *, int);