1/* BEGIN LICENSE BLOCK
2 * Version: CMPL 1.1
3 *
4 * The contents of this file are subject to the Cisco-style Mozilla Public
5 * License Version 1.1 (the "License"); you may not use this file except
6 * in compliance with the License.  You may obtain a copy of the License
7 * at www.eclipse-clp.org/license.
8 *
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See
11 * the License for the specific language governing rights and limitations
12 * under the License.
13 *
14 * The Original Code is  The ECLiPSe Constraint Logic Programming System.
15 * The Initial Developer of the Original Code is  Cisco Systems, Inc.
16 * Portions created by the Initial Developer are
17 * Copyright (C) 1989-2006 Cisco Systems, Inc.  All Rights Reserved.
18 *
19 * Contributor(s):
20 *
21 * END LICENSE BLOCK */
22
23/*
24 * SEPIA INCLUDE FILE
25 *
26 * VERSION	$Id: error.h,v 1.4 2012/02/10 20:15:23 jschimpf Exp $
27 *
28 * IDENTIFICATION		error.h
29 *
30 * DESCRIPTION:                 defines the SEPIA errors as their associated
31 *				error numbers.
32 */
33
34/*
35 * DEFINES:
36 */
37
38#define Set_Bip_Error(N)	g_emu_.global_bip_error = (N);
39#define Get_Bip_Error(N)	(N) = g_emu_.global_bip_error; Set_Bip_Error(0);
40#define Bip_Error_Fail(N)	Set_Bip_Error(N); Fail_;
41
42#define MAX_ERRORS		370	/* size of the message array */
43#define USER_ERROR		340	/* first user-reserved entry */
44
45/*
46 * Non-error status usually returned by the builtins
47 */
48
49/* 0..2,4..7 are PSUCCEED,PFAIL,PTHROW,PYIELD,PRUNNING,PWAITIO,PFLUSHIO	*/
50#define PKEEP			3	/* not used by builtins		*/
51/* 8..15 are used for delaying on builtin arguments	*/
52/* the lower 3 bits specify on which args to delay	*/
53/* if they are zero, the SV list is used to delay on 	*/
54#define PDELAY			8	/* delay on argument or SV list	*/
55#define PDELAY_MASK		7	/* mask for the arity		*/
56#define PDELAY_1		9	/* delay on argument 1		*/
57#define PDELAY_2		10	/* delay on argument 2		*/
58#define PDELAY_1_2		11	/* delay on argument 1 and 2	*/
59#define PDELAY_3		12	/* delay on argument 3		*/
60#define PDELAY_1_3		13	/* delay on argument 1 and 3	*/
61#define PDELAY_2_3		14	/* delay on argument 2 and 3	*/
62#define PDELAY_1_2_3		15	/* delay on argument 1, 2 and 3	*/
63#define PDELAY_BOUND		16	/* put on the bound list	*/
64
65/*
66 * Error codes are negative numbers in C code.
67 * Note that in Prolog the positive counterparts are used!
68 */
69
70#define PERROR			-1	/* general error */
71#define UNIFY_OVNI		-2	/* unknown object type */
72#if 0	/* these have been moved to ec_public.h */
73#define INSTANTIATION_FAULT	-4	/* variable instead of constant */
74#define TYPE_ERROR		-5	/* wrong type */
75#define RANGE_ERROR		-6	/* out of range */
76#endif
77#define BAD_FORMAT_STRING	-7	/* in printf */
78#define BAD_ARGUMENT_LIST	-8	/* in printf */
79
80#define META_TERM_UNIFY		-11	/* metaterm unification */
81#define	FAIL_TO_PAR_CHP		(-16)
82#define	CREATING_PAR_CHP	(-15)
83#define RECOMP_FAILED		-17	/* failure during oracle following */
84#define ARITH_EXCEPTION		-20	/* arithmetic exception(0 division) */
85#define COMPARE_TRAP		-23	/* non-number in comparison	*/
86#define ARITH_TYPE_ERROR	-24	/* non-number arithmetic operand */
87#define INTEGER_OVERFLOW	-25
88#define ARITY_LIMIT		-31	/* arity limit exceeded */
89#define EVENT_IGNORED		-32
90#define EVENT_QUEUE_FULL	-33
91#define STALE_HANDLE		-40	/* stale external object handle */
92#define NOGLOBAL		-41	/* global var. or array does not
93					 * exist */
94#define ARRAY_EXISTS		-42
95#define ILLEGAL_OP_DEF          -43     /* restriction on operator definition */
96#define LOCAL_REC		-44	/* local record exists		*/
97#define	NO_LOCAL_REC		-45	/* no local record		*/
98
99#define GROUND_CONST_MODIFY	-50
100
101#define NOENTRY			-60	/* entry does not exist */
102#define TOOL_REDEF		-61
103#define INCONSISTENCY		-62
104#define	NOT_DYNAMIC		-63	/* should be dynamic */
105#define ALREADY_DYNAMIC		-64
106#define ALREADY_DEFINED		-65	/* probably not necessary */
107#define REDEF_SYS		-66
108#define NOT_LOADED		-67
109#define CALLING_UNDEFINED	-68
110#define CALLING_AUTOLOAD	-69
111#define ACCESSING_UNDEF_DYN_PROC -70	/* no defined dynamic at all */
112#define ALREADY_PARALLEL	-71
113#define UNDEF_OPERATOR		-72
114#define REDEF_OPERATOR		-73
115#define HIDING_OPERATOR		-74
116#define CALLING_DYNAMIC		-79
117
118#define MODULENAME		-80
119#define DIRECTIVE		-81
120#define LOCKED			-82
121#define NO_LOOKUP_MODULE	-86
122#define REEXPORT_EXISTS		-90
123#define NO_TOOL			-91
124#define LOCAL_EXISTS		-92
125#define EXPORT_EXISTS		-93
126#define IMPORT_EXISTS		-94
127#define IMPORT_PENDING		-95
128#define IMPORT_CLASH_RESOLVE	-96
129#define MODULE_EXISTS		-97
130#define WRONG_UNLOCK_STRING	-98
131#define IMPORT_CLASH		-99
132#define	ACCESSING_NON_LOCAL	-100
133#define SELF_DESTRUCTION	-101
134
135#define	ERR_PARSE		-110
136
137#define PUNCTUATION             -111
138#define ILL_QUOTED		-112
139#define UNEXCOMMA 	        -113
140#define UNEXPECTED              -114
141#define ENDOFFILE               -115
142#define	BAD_NUMERIC_CONSTANT	-116
143#define BRACKET                 -117
144#define	ENDOFCLAUSE		-118
145#define	POSTINF			-119
146#define	SOLOCH			-120
147#define BLANK			-121
148#define MULTI_META		-122
149
150#define	PREFINF			-124
151#define	UNCLOSBR 		-125
152#define GRAMMAR_HEAD		-126
153#define GRAMMAR_BODY		-127
154#define TRANS_ERROR		-128
155#define	QUERY_FLOUNDERED	-129
156#define	ILLEGAL_HEAD		-130
157#define	ILLEGAL_GOAL		-131
158#define VARIABLE_GOAL		ILLEGAL_GOAL
159#define WRONG_TYPE              -132
160#define	LIBRARY			-133
161#define	CONSECUTIVE		-134
162#define	PROTECT_REDEF		-135
163#define	BUILT_IN_REDEF		-136
164#define	INCONSISTENT_REDEF	-137
165#define COMPILED_FILE		-139
166#define UNDEFINED		-140	/* unknown instruction */
167#define UNIMPLEMENTED		-141
168#define NOT_AVAILABLE		-142
169#define QUERY_FAILED		-143
170#define MULTIFILE		-145
171#define BAD_PRAGMA		-148
172#define CODE_UNIT_LOADED	-149
173#define GLOBAL_TR_EXISTS	-160
174#define TR_IN_MOD		-161
175#define NO_TR			-162
176#define	ONE_SQ_AQ		-163
177#define SYS_ERROR		-170	/* (host) system error; errno usually
178					 *  holds the real error code.
179					 * The global variable whose did is
180					 * "d_errno_" should be set by the
181					 * macro "Set_Errno" to the system
182					 * "errno" describing the error.
183					 */
184#define NO_FILE			-171
185#define MPS_ERROR		-176
186#define NO_SHARED_LIB		-177
187#define PEOF			-190	/* end of file in an IO predicate */
188#define OUT_ERROR		-191	/* like SYS_ERROR for output functions*/
189#define STREAM_MODE		-192 	/* wrong stream mode */
190#define STREAM_SPEC		-193
191#define TOO_MANY_NAMES		-194
192#define YIELD_ON_FLUSH_REQ	-195
193#define SYSTEM_STREAM		-196
194#define INCORRECT_USER		-197
195#define READ_PAST_EOF		-198	/* reading after PEOF was reached */
196#define	REMEMBER		-210
197#define NOCODE			-211	/* no code in the descriptor	*/
198#define ILLEGAL_RETURN		-212	/* bad return code from external */
199#define EC_EXTERNAL_ERROR	-213
200#define EC_LICENSE_ERROR	-214
201
202#define IC_EXCLUSION_ERROR	-220    /* A value was excluded from
203                                           an IC variable which should
204                                           have been representable in
205                                           the domain but was not
206                                           because of size limitations
207                                           (eg. size of a bitmap) */
208
209#define	DEBUG_INIT_EVENT	-250	/* debugger interface events */
210#define	DEBUG_PORT_EVENT	-252
211#define	DEBUG_BIPFAIL_EVENT	-251	/* debug notification events */
212#define	DEBUG_CALL_EVENT	-253
213#define	DEBUG_EXIT_EVENT	-254
214#define	DEBUG_REDO_EVENT	-255
215#define	DEBUG_DELAY_EVENT	-256
216#define	DEBUG_WAKE_EVENT	-257
217#define	DEBUG_BIPCALL_EVENT	-258
218#define	DEBUG_BIPEXIT_EVENT	-259
219#define	DEBUG_SUSP_EVENT	-249
220
221#define UNEXPECTED_EOF		-260
222#define INVALID_SS		-261
223#define CANT_ALLOCATE		-262
224#define WRONG_LEVEL		-263
225#define NOT_DUMP_FILE		-264
226#define BAD_DUMP_VERSION	-265
227#define NOT_IMPLEMENTED		-267
228#define NOT_IN_PARALLEL		-268
229
230#define	UNDEF_ATTR	        -270
231#define	ATTR_FORMAT	        -271
232#define	BAD_DELAY_CONDITION     -272
233#define	BAD_RESTORE_WL		-274
234
235#define KEGI_GENERAL_SUNVIEW	-330
236#define KEGI_GENERAL_X11	-331
237
238/* Panic messages */
239#define	MEMORY_P		"Out of memory - no more swap space"
240#define MEMORY_CORRUPTED_P	"Internal error - memory corrupted"
241
242#define Not_Available_Built_In(Name)		\
243		static int Name(){Bip_Error(NOT_AVAILABLE);}
244