File: define.h

package info (click to toggle)
lush 1.0%2Bfinal-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 19,256 kB
  • ctags: 4,254
  • sloc: ansic: 45,498; sh: 3,138; cpp: 2,456; makefile: 372; lisp: 79; python: 5
file content (236 lines) | stat: -rw-r--r-- 6,266 bytes parent folder | download
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/***********************************************************************
 * 
 *  LUSH Lisp Universal Shell
 *    Copyright (C) 2002 Leon Bottou, Yann Le Cun, AT&T Corp, NECI.
 *  Includes parts of TL3:
 *    Copyright (C) 1987-1999 Leon Bottou and Neuristique.
 *  Includes selected parts of SN3.2:
 *    Copyright (C) 1991-2001 AT&T Corp.
 * 
 *  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 2 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 this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA
 * 
 ***********************************************************************/

/***********************************************************************
 * $Id: define.h,v 1.13 2004/07/23 21:05:13 leonb Exp $
 **********************************************************************/

#ifndef DEFINE_H
#define DEFINE_H

#ifdef HAVE_CONFIG_H
# include "lushconf.h"
#else
# ifdef WIN32
#  define HAVE_STRFTIME 1
#  define STDC_HEADERS  1  
#  define HAVE_STRCHR   1
#  define HAVE_MEMCPY   1
#  define HAVE_STRERROR 1
# endif
#endif

/* --------- GENERAL PURPOSE DEFINITIONS ---------- */

#include <setjmp.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <string.h>

/* untyped pointer */
typedef void* gptr;
#define NIL 0L

/* boolean constants */
#ifndef TRUE
# define TRUE 1
# define FALSE 0
#endif

/* --------- UNFORTUNATE NAMES -------- */

#define abort     TLabort
#define error     TLerror
#define class     TLclass
#define true      TLtrue
#define basename  TLbasename
#define dirname   TLdirname

/* --------- MACHINE DEPENDANT STUFF -------- */

#ifdef WIN32
# define main             lushmain
# define exit             win32_exit
# define isatty           win32_isatty
# define popen            win32_popen
# define pclose           win32_pclose
# define FMODE_TEXT(f)    win32_fmode_text(f);
# define FMODE_BINARY(f)  win32_fmode_binary(f);
# define INIT_MACHINE     init_win32()
# define TOPLEVEL_MACHINE break_attempt=0
# define CHECK_MACHINE(s) if (break_attempt) win32_user_break(s)
# define DLLEXPORT        __declspec(dllexport)
# define DLLIMPORT        __declspec(dllimport)
# if ! defined(TLAPI)
#  if defined(TL3DLL)
#   define TLAPI DLLEXPORT
#  else  /* !defined TL3DLL && !defined(_CONSOLE) */
#   define TLAPI DLLIMPORT
#  endif /* !defined(TL3DLL) */
# endif /* !defined(TLAPI) */
# if defined (_MSC_VER) && (_MSC_VER == 1100)
#  pragma optimize("p",on)
#  pragma warning(disable: 4056)
# endif /* VC50 */
#endif /* WIN32 */

#ifdef AMIGA
/* This is not up-to-date */
# define INIT_MACHINE      init_amiga()
# define CHECK_MACHINE(s)  check_amiga("Break "s)
# define putc(c,stream)    aputc(c,stream)
# define getc(stream)      agetc(stream)
#endif

#ifdef UNIX
# define INIT_MACHINE      init_unix()
# define FINI_MACHINE      fini_unix()
# define TOPLEVEL_MACHINE  toplevel_unix()
# define CHECK_MACHINE(s)  if (break_attempt) user_break(s)
# ifdef HAVE_WAITPID
#  define NEED_POPEN
# endif
# define popen             unix_popen
# define pclose            unix_pclose
# ifdef __CYGWIN32__
#  define FMODE_TEXT(f)    cygwin_fmode_text(f);
#  define FMODE_BINARY(f)  cygwin_fmode_binary(f);
# endif
#endif

#ifndef TLAPI
# define TLAPI            /**/
#endif
#ifndef LUSHAPI
# define LUSHAPI TLAPI
#endif
#ifndef INIT_MACHINE
# define INIT_MACHINE     /**/
#endif
#ifndef FINI_MACHINE
# define FINI_MACHINE     /**/
#endif
#ifndef TOPLEVEL_MACHINE
# define TOPLEVEL_MACHINE /**/
#endif
#ifndef CHECK_MACHINE
# define CHECK_MACHINE    /**/
#endif
#ifndef FMODE_TEXT
# define FMODE_TEXT(f)    /**/
#endif
#ifndef FMODE_BINARY
# define FMODE_BINARY(f)  /**/
#endif

/* --------- AUTOCONF --------- */

#if STDC_HEADERS
# include <string.h>
#else
# ifdef HAVE_STRINGS_H
#  include <strings.h>
# else
#  include <string.h>
# endif
# ifndef HAVE_STRCHR
#  define strchr index
#  define strrchr rindex
# endif
# ifdef HAVE_MEMORY_H
#  include <memory.h>
# endif
# ifndef HAVE_MEMCPY
#  define memcpy(d,s,n) bcopy((s),(d),(n))
#  define memset(d,c,n) do{char *dd=d;int nn=n;while(nn-->0)*dd++=c;}while(0)
# endif
#endif

#ifndef STDC_HEADERS
# ifdef toupper
#  undef toupper
# endif
# ifdef tolower
#  undef tolower
# endif
# define NEED_TOUPPER
# define NEED_TOLOWER
#endif

#ifndef HAVE_SIGSETJMP
# ifndef sigsetjmp
#  ifndef siglongjmp
#   ifndef sigjmp_buf
#    define sigjmp_buf jmp_buf
#    define sigsetjmp(env, arg) setjmp(env)
#    define siglongjmp(env, arg) longjmp(env,arg)
#   endif
#  endif
# endif
#endif

#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif

/* --------- GENERIC NAMES --------------- */

/* These macros may be redefined in
 * the machine dependent part, just below 
 */

#ifdef __STDC__			/* Defined by ANSI compilers */
# define name2(a,b)      _name2(a,b)
# define _name2(a,b)     a##b
# define name3(a,b,c)    _name3(a,b,c)
# define _name3(a,b,c)   a##b##c
#else
# define name2(a,b)      a/**/b
# define name3(a,b,c)    a/**/b/**/c
#endif

/* return the variable in a string */
#ifdef __STDC__
# define enclos2_in_string(a) #a
# define enclose_in_string(a) enclos2_in_string(a)
#else
# define enclose_in_string(a) "a"
#endif

/* --------- LISP CONSTANTS --------- */

#define DXSTACKSIZE   (int)3000	/* max size for the DX stack */
#define MAXARGMAPC    (int)8	/* max number of listes in MAPCAR */
#define CONSCHUNKSIZE (int)2048	/* minimal cons allocation unit */
#define HASHTABLESIZE (int)1024	/* symbol hashtable size */
#define STRING_BUFFER (int)4096	/* string operations buffer size */
#define LINE_BUFFER   (int)1024	/* line buffer length */
#define FILELEN       (int)1024	/* file names length */
#define DZ_STACK_SIZE (int)1000 /* stack size for DZs */

/* ---------------------------------- */
#endif