1 /* $Id$
2  *  include file to define general vixie-type things
3  *  v1.0 vix 21jun86 [broken out of as.h]
4  *
5  *
6  * HUSKYLIB: common defines, types and functions for HUSKY
7  *
8  * This is part of The HUSKY Fidonet Software project:
9  * see http://husky.sourceforge.net for details
10  *
11  *
12  * HUSKYLIB is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU Lesser General Public
14  * License as published by the Free Software Foundation; either
15  * version 2 of the License, or (at your option) any later version.
16  *
17  * HUSKYLIB is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20  * General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; see file COPYING. If not, write to the
24  * Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * See also http://www.gnu.org, license may be found here.
27  */
28 
29 #ifdef  DOCUMENTATION
30 
31 There are two macros you can define before including this file which can
32 change the things defined by this file.
33 
34 DVIXIE: if defined, will cause enter/exit messages to be printed by the
35         ENTER/EXIT/EXITV macros.  If not defined, causes ENTER to do nothing,
36         and EXIT/EXITV to generate 'return' without any messages.
37 
38         If defined, should be set to the name of the including module.
39 
40 MAIN:   Should be defined for a program containing a main() function which
41         is linked with other modules which include this file.
42 
43         Value is not important, only existence/nonexistence matters.
44 
45 #endif  /*DOCUMENTATION*/
46 
47 
48 #ifndef HUSKY_VIXIE_H
49 #define HUSKY_VIXIE_H
50 
51 
52                                                 /*--- debugging stuff ---*/
53 #define MAXPROC 256
54 
55 #ifdef DVIXIE
56 #define ENTER(proc) { \
57                         APC_PROCS[I_PROC] = proc; \
58                         printf("ENTER(%d:%s.%s)\n", \
59                                 I_PROC, DVIXIE, APC_PROCS[I_PROC]); \
60                         I_PROC++; \
61                 }
62 #define EXIT(value) { \
63                         I_PROC--; \
64                         printf("EXIT(%d:%s.%s)\n", \
65                                 I_PROC, DVIXIE, \
66                                 APC_PROCS[I_PROC]); \
67                         return value; \
68                 }
69 #define EXITV { \
70                         I_PROC--; \
71                         printf("EXITV(%d:%s.%s)\n", \
72                                 I_PROC, DVIXIE, \
73                                 APC_PROCS[I_PROC]); \
74                         return; \
75                 }
76 #else
77 #define ENTER(proc)
78 #define EXIT(value)     {return value;}
79 #define EXITV           return;
80 #endif
81 
82 #ifdef MAIN
83 int     I_PROC = 0;
84 char    *APC_PROCS[MAXPROC];
85 #else
86 extern  int     I_PROC;
87 extern  char    *APC_PROCS[MAXPROC];
88 #endif
89 
90 #endif
91