File: Aaa_intern.h

package info (click to toggle)
gv 1%3A3.7.4-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 3,752 kB
  • ctags: 3,963
  • sloc: ansic: 31,837; sh: 3,914; makefile: 331; perl: 226
file content (174 lines) | stat: -rw-r--r-- 4,921 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
**
** Aaa_intern.h
**
** Copyright (C) 1995, 1996, 1997 Johannes Plass
** Copyright (C) 2004 Jose E. Marchesi
** 
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 3 of the License, or
** (at your option) any later version.
** 
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with GNU gv; see the file COPYING.  If not, write to
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
** Boston, MA 02111-1307, USA.
** 
** Authors:   Johannes Plass (plass@thep.physik.uni-mainz.de)
**            Department of Physics
**            Johannes Gutenberg-University
**            Mainz, Germany
**
**            Jose E. Marchesi (jemarch@gnu.org)
**            GNU Project
**
*/
 
#ifndef	_AAA_INTERN_H_
#define	_AAA_INTERN_H_

/*
#define MESSAGES
#define MEMDEBUG
*/

/*---------------------------------------------------------*/
/* Include */
/*---------------------------------------------------------*/

#include    <stdio.h>
#include    <stdlib.h>

#include    "paths.h"
#include    INC_X11(Xlib.h)
#include    INC_X11(Xresource.h)
#include    INC_X11(IntrinsicP.h)
#include    INC_X11(cursorfont.h)
#include    INC_X11(StringDefs.h)

#include    INC_XMU(Misc.h)
#include    INC_XMU(Converters.h)
#define DESTROY_EXPLICITLY
#include    "AaaP.h"

#ifdef MEMDEBUG
#   define MESSAGES
#endif

#include    "message.h"

#ifdef MEMDEBUG
#   define MEMMESSAGE(sss)      INFMESSAGE(sss)
#   define MEMBEGINMESSAGE(sss) BEGINMESSAGE(sss)
#   define MEMENDMESSAGE(sss)   ENDMESSAGE(sss)
#else
#   define MEMMESSAGE(sss)
#   define MEMBEGINMESSAGE(sss)
#   define MEMENDMESSAGE(sss)
#endif

/*---------------------------------------------------------*/
/* Bison Configuration */
/*---------------------------------------------------------*/

typedef union {
    int		    ival;
    XrmQuark	    qval;
    BoxPtr	    bval;
    BoxParamsPtr    pval;
    GlueRec	    gval;
    LayoutDirection lval;
    ExprPtr	    eval;
    Operator	    oval;
} YYSTYPE;

typedef struct _LayoutConverterStruct {
   String    base;
   String    oldfrom;
   String    from;
   LayoutPtr *to;
}  LayoutConverterStruct, *LayoutConverterArg;

#define YYPARSE_PARAM  layoutConverterArg 
#define YYLEX_PARAM    layoutConverterArg

/* ###todo###
   Currently I have no time to take care of alloca used in the dynamic stack
   extension, therefore we just show a polite message and exit in case a stack
   overflow occurs ###jp###.
   By the way, YYINITDEPTH=200 is already pretty much, I never got a stack size
   larger than 40 with the layouts I use. ###jp###   
*/
#define YYINITDEPTH 200
#define yyoverflow(a1,a2,a3,a4,a5,a6)				\
{								\
   fprintf(stderr,"yyoverflow: stack overflow\n");		\
   fprintf(stderr,"   maximal stacksize: %d\n",yystacksize);	\
   fprintf(stderr,"   used             : %d\n",size);		\
   fprintf(stderr,"Overflow forces image exit, bye bye.\n");	\
   exit(0);						        \
}

extern int layout_parse (void *);
extern void layout_scan_error (char *, void *);
extern int layout_lex (YYSTYPE *, void *);

#define layout_error(sss)       layout_scan_error(sss,YYLEX_PARAM)

/*---------------------------------------------------------*/
/* Macros */
/*---------------------------------------------------------*/

#define New(ttt)      (ttt *) XtMalloc(sizeof(ttt))
#define Dispose(xxx)  XtFree((XtPointer)xxx)
#define Some(ttt,nnn) (ttt *) XtMalloc(sizeof(ttt)*nnn)
#define More(xxx,ttt,nnn)   (			\
 (xxx) ?					\
 (ttt *) XtRealloc(xxx,sizeof(ttt)*nnn) :	\
 (ttt *) XtMalloc(sizeof(ttt)*nnn)		\
)

#define GlueEqual(a,b)			\
 ( (a).order == (b).order && (a).value == (b).value )

#define AddGlue(r,a,b)			\
   if (a.order == b.order) {		\
      r.order = a.order;		\
      r.value = a.value + b.value;	\
   } else {				\
      if (a.order > b.order) r = a;	\
      else                   r = b;	\
   }

#define MinGlue(r,b)				\
   if (r.order == b.order) {			\
      if (r.value > b.value) r.value = b.value;	\
   } else {					\
      if (r.order > b.order) r = b;		\
   }

#define SubGlue(r,a,b)			\
   if (a.order == b.order) {		\
      r.order = a.order;		\
      r.value = a.value - b.value;	\
   } else {				\
      if (a.order > b.order)		\
         r = a;				\
      else {				\
         r.order = b.order;		\
         r.value = -b.value;		\
      }					\
   }

#define ZeroGlue(g)	((g).value = 0, (g).order = 0, (g).expr = 0)
#define IsZeroGlue(g)	((g).value == 0)

#define QuarkToWidget(l,q)  XtNameToWidget((Widget) l, (char *) XrmQuarkToString(q))

#endif /* _AAA_INTERN_H_ */