Linuxpops  3.01.04
Spectral Anaysis Package for Single Dish Data
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
utils.h
Go to the documentation of this file.
1 /*
2  * Grace - GRaphing, Advanced Computation and Exploration of data
3  *
4  * Home page: http://plasma-gate.weizmann.ac.il/Grace/
5  *
6  * Copyright (c) 1991-95 Paul J Turner, Portland, OR
7  * Copyright (c) 1996-99 Grace Development Team
8  *
9  * Maintained by Evgeny Stambulchik <fnevgeny@plasma-gate.weizmann.ac.il>
10  *
11  *
12  * All Rights Reserved
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 2 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * You should have received a copy of the GNU General Public License
25  * along with this program; if not, write to the Free Software
26  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27  */
28 
29 #ifndef __UTILS_H_
30 #define __UTILS_H_
31 
32 /* for size_t */
33 #include <sys/types.h>
34 
35 #define PAD(bits, pad) (((bits)+(pad)-1)&-(pad))
36 
37 #define MIN2(a, b) (((a) < (b)) ? a : b)
38 #define MAX2(a, b) (((a) > (b)) ? a : b)
39 #define MIN3(a, b, c) (((a) < (b)) ? MIN2(a, c) : MIN2(b, c))
40 #define MAX3(a, b, c) (((a) > (b)) ? MAX2(a, c) : MAX2(b, c))
41 
42 #define yes_or_no(x) ((x)?"yes":"no")
43 #define on_or_off(x) ((x)?"on":"off")
44 #define true_or_false(x) ((x)?"true":"false")
45 #define w_or_v(x) ((x == COORD_WORLD)?"world":"view")
46 
47 #define LFORMAT_TYPE_PLAIN 0
48 #define LFORMAT_TYPE_EXTENDED 1
49 
50 #define cxfree(ptr) xfree(ptr); ptr = NULL
51 
52 #define PSTRING(s) ((s == NULL) ? "" : escapequotes(s))
53 
54 void xfree(void *ptr);
55 void *xrealloc(void *ptr, size_t size);
56 void fswap(double *x, double *y);
57 void iswap(int *x, int *y);
58 int isoneof(int c, char *s);
59 int argmatch(char *s1, char *s2, int atleast);
60 void lowtoupper(char *s);
61 void convertchar(char *s);
62 int ilog2(int n);
63 double comp_area(int n, double *x, double *y);
64 double comp_perimeter(int n, double *x, double *y);
65 
66 char *create_fstring(int form, int prec, double loc, int type);
67 char *escapequotes (char *s);
68 
69 int sign(double a);
70 double mytrunc(double a);
71 
72 void bailout(void);
73 
74 void installSignal(void);
75 
76 int bin_dump(char *value, int i, int pad);
77 unsigned char reversebits(unsigned char inword);
78 
79 char *copy_string(char *dest, const char *src);
80 char *concat_strings(char *dest, const char *src);
81 int compare_strings(const char *s1, const char *s2);
82 void reverse_string(char *s);
83 
84 char *get_grace_home(void);
85 void set_grace_home(const char *dir);
86 
87 char *get_help_viewer(void);
88 void set_help_viewer(const char *dir);
89 
90 char *get_print_cmd(void);
91 void set_print_cmd(const char *cmd);
92 
93 char *get_editor(void);
94 void set_editor(const char *cmd);
95 
96 char *get_docname(void);
97 void set_docname(const char *s);
98 
99 void errmsg(char *buf);
100 void echomsg(char *msg);
101 void stufftext(char *s, int sp);
102 void log_results(char *buf);
103 
104 int yesnoterm(char *msg);
105 int yesno(char *msg, char *s1, char *s2, char *help_anchor);
106 
107 int fexists(const char *to);
108 
109 char *mybasename(const char *s);
110 
111 void expand_tilde(char *buf);
112 int set_workingdir(const char *wd);
113 char *get_workingdir(void);
114 
115 void init_username(void);
116 char *get_username(void);
117 
118 void init_userhome(void);
119 char *get_userhome(void);
120 
121 void update_app_title(void);
122 
123 void set_dirtystate(void);
124 void clear_dirtystate(void);
125 void lock_dirtystate(int flag);
126 int is_dirtystate(void);
127 
128 int system_wrap(const char *string);
129 void msleep_wrap(unsigned int msec);
130 
131 int init_locale(void);
132 void set_locale_num(int flag);
133 
134 long bi_version_id(void);
135 char *bi_version_string(void);
136 char *bi_system(void);
137 char *bi_date(void);
138 char *bi_gui(void);
139 char *bi_ccompiler(void);
140 char *bi_t1lib(void);
141 
142 #ifdef DEBUG
143 void set_debuglevel(int level);
144 int get_debuglevel(void);
145 #endif
146 
147 #endif /* __UTILS_H_*/
void bailout(void)
char * bi_gui(void)
void set_grace_home(const char *dir)
unsigned char reversebits(unsigned char inword)
long bi_version_id(void)
int fexists(const char *to)
char * bi_t1lib(void)
char * copy_string(char *dest, const char *src)
void set_docname(const char *s)
void set_print_cmd(const char *cmd)
void init_userhome(void)
char * get_editor(void)
int init_locale(void)
void lock_dirtystate(int flag)
void xfree(void *ptr)
Definition: grace_fit.c:122
char * get_print_cmd(void)
void fswap(double *x, double *y)
void clear_dirtystate(void)
char * get_userhome(void)
void installSignal(void)
char * create_fstring(int form, int prec, double loc, int type)
int sign(double a)
char * bi_system(void)
int yesno(char *msg, char *s1, char *s2, char *help_anchor)
void lowtoupper(char *s)
void init_username(void)
int set_workingdir(const char *wd)
void convertchar(char *s)
char * bi_version_string(void)
void reverse_string(char *s)
int bin_dump(char *value, int i, int pad)
char * mybasename(const char *s)
void expand_tilde(char *buf)
void echomsg(char *msg)
int compare_strings(const char *s1, const char *s2)
double mytrunc(double a)
void set_dirtystate(void)
char * concat_strings(char *dest, const char *src)
void * xrealloc(void *ptr, size_t size)
int is_dirtystate(void)
void set_locale_num(int flag)
void msleep_wrap(unsigned int msec)
int isoneof(int c, char *s)
char * bi_date(void)
void set_help_viewer(const char *dir)
void errmsg(char *buf)
double comp_perimeter(int n, double *x, double *y)
void stufftext(char *s, int sp)
int ilog2(int n)
int argmatch(char *s1, char *s2, int atleast)
Definition: dataserv.c:559
int system_wrap(const char *string)
char * get_help_viewer(void)
char * get_docname(void)
char * bi_ccompiler(void)
char * get_username(void)
void iswap(int *x, int *y)
int yesnoterm(char *msg)
char * escapequotes(char *s)
char * get_grace_home(void)
char * get_workingdir(void)
void update_app_title(void)
void set_editor(const char *cmd)
double comp_area(int n, double *x, double *y)
void log_results(char *buf)