Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – tendra.SVN – Blame – /branches/tendra5-amd64/src/tools/tnc/check_def.h – Rev 6

Subversion Repositories tendra.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
6 7u83 2
 * Copyright (c) 2002-2005 The TenDRA Project <http://www.tendra.org/>.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *
8
 * 1. Redistributions of source code must retain the above copyright notice,
9
 *    this list of conditions and the following disclaimer.
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
11
 *    this list of conditions and the following disclaimer in the documentation
12
 *    and/or other materials provided with the distribution.
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
14
 *    may be used to endorse or promote products derived from this software
15
 *    without specific, prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
 *
29
 * $Id$
30
 */
31
/*
2 7u83 32
    		 Crown Copyright (c) 1997
6 7u83 33
 
2 7u83 34
    This TenDRA(r) Computer Program is subject to Copyright
35
    owned by the United Kingdom Secretary of State for Defence
36
    acting through the Defence Evaluation and Research Agency
37
    (DERA).  It is made available to Recipients with a
38
    royalty-free licence for its use, reproduction, transfer
39
    to other parties and amendment for any purpose not excluding
40
    product development provided that any such use et cetera
41
    shall be deemed to be acceptance of the following conditions:-
6 7u83 42
 
2 7u83 43
        (1) Its Recipients shall ensure that this Notice is
44
        reproduced upon any copies or amended versions of it;
6 7u83 45
 
2 7u83 46
        (2) Any amended version of it shall be clearly marked to
47
        show both the nature of and the organisation responsible
48
        for the relevant amendment or amendments;
6 7u83 49
 
2 7u83 50
        (3) Its onward transfer from a recipient to another
51
        party shall be deemed to be that party's acceptance of
52
        these conditions;
6 7u83 53
 
2 7u83 54
        (4) DERA gives no warranty or assurance as to its
55
        quality or suitability for any purpose and DERA accepts
56
        no liability whatsoever in relation to any use to which
57
        it may be put.
58
*/
59
 
60
 
61
/*
62
    SHAPE CHECKING MACRO DEFINITIONS
63
 
64
    This file contains the definitions for the shape checking macros
65
    generated in check_exp.h.
66
*/
67
 
68
#if FS_TENDRA
6 7u83 69
#define UNUSED_ARG(A)			UNUSED(A)
2 7u83 70
#else
6 7u83 71
#define UNUSED_ARG(A)			((void)(A))
2 7u83 72
#endif
73
 
6 7u83 74
#define CHECK_exp_apply_token		chk_token(exp);
2 7u83 75
 
76
#define CHECK_exp_cond\
6 7u83 77
	IGNORE check1(ENC_integer, control);\
78
	chk_cond(exp);
2 7u83 79
 
80
#define CHECK_abs			CHECK_negate
81
 
82
#define CHECK_add_to_ptr\
6 7u83 83
	node *sh1 = check1(ENC_pointer, arg1);\
84
	node *sh2 = check1(ENC_offset, arg2);\
85
	al_includes(ptr_to(sh1), offset_from(sh2));\
86
	exp->shape = sh_pointer(offset_to(sh2));
2 7u83 87
 
88
#define CHECK_and\
6 7u83 89
	exp->shape = normalize(check2(ENC_integer, arg1, arg2));
2 7u83 90
 
91
#define CHECK_apply_proc\
6 7u83 92
	exp->shape = normalize(result_shape);\
93
	IGNORE check1(ENC_proc, p);\
94
	UNUSED_ARG(params);\
95
	UNUSED_ARG(var_param);
2 7u83 96
 
97
#define CHECK_apply_general_proc\
6 7u83 98
	exp->shape = normalize(result_shape);\
99
	IGNORE check1(ENC_proc, p);\
100
	UNUSED_ARG(postlude);
2 7u83 101
 
102
#define CHECK_assign\
6 7u83 103
	node *sh1 = check1(ENC_pointer, arg1);\
104
	al_includes(ptr_to(sh1), al_shape(arg2));\
105
	exp->shape = sh_top;
2 7u83 106
 
107
#define CHECK_assign_with_mode		CHECK_assign
108
 
109
#define CHECK_bitfield_assign\
6 7u83 110
	node *sh1 = check1(ENC_pointer, arg1);\
111
	node *sh2 = check1(ENC_offset, arg2);\
112
	node *sh3 = check1(ENC_bitfield, arg3);\
113
	al_includes(ptr_to(sh1), offset_from(sh2));\
114
	al_includes(offset_to(sh2), al_shape(sh3));\
115
	exp->shape = sh_top;
2 7u83 116
 
117
#define CHECK_bitfield_assign_with_mode	CHECK_bitfield_assign
118
 
119
#define CHECK_bitfield_contents\
6 7u83 120
	node *sh = sh_bitfield(v);\
121
	node *sh1 = check1(ENC_pointer, arg1);\
122
	node *sh2 = check1(ENC_offset, arg2);\
123
	al_includes(ptr_to(sh1), offset_from(sh2));\
124
	al_includes(offset_to(sh2), al_shape(sh));\
125
	exp->shape = sh;
2 7u83 126
 
127
#define CHECK_bitfield_contents_with_mo	CHECK_bitfield_contents
128
 
129
#define CHECK_case\
6 7u83 130
	IGNORE check1(ENC_integer, control);\
131
	if (exhaustive && exhaustive->cons->encoding == ENC_true) {\
2 7u83 132
	    exp->shape = sh_bottom ;\
133
	} else {\
134
	    exp->shape = sh_top ;\
135
	}
136
 
137
#define CHECK_change_bitfield_to_int\
6 7u83 138
	exp->shape = sh_integer(v);\
139
	IGNORE check1(ENC_bitfield, arg1);
2 7u83 140
 
141
#define CHECK_change_floating_variety\
6 7u83 142
	exp->shape = sh_floating(r);\
143
	IGNORE check1(ENC_floating, arg1);
2 7u83 144
 
145
#define CHECK_change_variety\
6 7u83 146
	exp->shape = sh_integer(r);\
147
	IGNORE check1(ENC_integer, arg1);
2 7u83 148
 
149
#define CHECK_change_int_to_bitfield\
6 7u83 150
	exp->shape = sh_bitfield(bv);\
151
	IGNORE check1(ENC_integer, arg1);
2 7u83 152
 
153
#define CHECK_complex_conjugate\
6 7u83 154
	exp->shape = normalize(c->shape);
2 7u83 155
 
156
#define CHECK_component\
6 7u83 157
	exp->shape = normalize(sha);\
158
	IGNORE check1(ENC_compound, arg1);\
159
	IGNORE check1(ENC_offset, arg2);
2 7u83 160
 
161
#define CHECK_concat_nof\
6 7u83 162
	exp->shape = normalize(check2(ENC_nof, arg1, arg2));
2 7u83 163
 
164
#define CHECK_conditional\
6 7u83 165
	exp->shape = normalize(lub(first->shape, alt->shape));
2 7u83 166
 
167
#define CHECK_contents\
6 7u83 168
	node *sh1 = check1(ENC_pointer, arg1);\
169
	al_includes(ptr_to(sh1), al_shape(s));\
170
	exp->shape = normalize(s);
2 7u83 171
 
172
#define CHECK_contents_with_mode	CHECK_contents
173
 
174
#define CHECK_current_env\
6 7u83 175
	exp->shape = sh_pointer(al_frame);
2 7u83 176
 
177
#define CHECK_div0			CHECK_and
178
 
179
#define CHECK_div1			CHECK_and
180
 
181
#define CHECK_div2			CHECK_and
182
 
183
#define CHECK_env_offset\
6 7u83 184
	exp->shape = sh_offset(fa, y);\
185
	chk_tag(exp, t, 0);
2 7u83 186
 
187
#define CHECK_env_size\
6 7u83 188
	exp->shape = sh_offset(al_frame, al_top);\
189
	IGNORE check1(ENC_proc, proctag);
2 7u83 190
 
191
#define CHECK_fail_installer\
192
	exp->shape = sh_bottom ;\
6 7u83 193
	UNUSED_ARG(message);
2 7u83 194
 
195
#define CHECK_float_int\
6 7u83 196
	exp->shape = sh_floating(f);\
197
	IGNORE check1(ENC_integer, arg1);
2 7u83 198
 
199
#define CHECK_floating_abs\
6 7u83 200
	exp->shape = normalize(check1(ENC_floating, arg1));
2 7u83 201
 
202
#define CHECK_floating_div\
6 7u83 203
	exp->shape = normalize(check2(ENC_floating, arg1, arg2));
2 7u83 204
 
205
#define CHECK_floating_minus		CHECK_floating_div
206
 
207
#define CHECK_floating_maximum		CHECK_floating_div
208
 
209
#define CHECK_floating_minimum		CHECK_floating_div
210
 
211
#define CHECK_floating_mult\
6 7u83 212
	exp->shape = normalize(checkn(ENC_floating, arg1, 1));
2 7u83 213
 
214
#define CHECK_floating_negate		CHECK_floating_abs
215
 
216
#define CHECK_floating_plus		CHECK_floating_mult
217
 
218
#define CHECK_floating_power\
6 7u83 219
	exp->shape = normalize(check1(ENC_floating, arg1));\
220
	IGNORE check1(ENC_integer, arg2);
2 7u83 221
 
222
#define CHECK_floating_test\
223
	exp->shape = sh_top ;\
6 7u83 224
	IGNORE check2(ENC_floating, arg1, arg2);
2 7u83 225
 
6 7u83 226
#define CHECK_goto			exp->shape = sh_bottom;
2 7u83 227
 
228
#define CHECK_goto_local_lv\
229
	exp->shape = sh_bottom ;\
6 7u83 230
	IGNORE check1(ENC_pointer, arg1);
2 7u83 231
 
232
#define CHECK_identify\
6 7u83 233
	exp->shape = normalize(body->shape);\
234
	chk_tag(exp, name_intro, 1);\
235
	UNUSED_ARG(definition);
2 7u83 236
 
237
#define CHECK_ignorable\
6 7u83 238
	exp->shape = normalize(arg1->shape);
2 7u83 239
 
240
#define CHECK_imaginary_part\
241
	exp->shape = null ;\
6 7u83 242
	UNUSED_ARG(arg1);
2 7u83 243
 
244
#define CHECK_initial_value\
6 7u83 245
	exp->shape = normalize(init->shape);
2 7u83 246
 
247
#define CHECK_integer_test\
248
	exp->shape = sh_top ;\
6 7u83 249
	IGNORE check2(ENC_integer, arg1, arg2);
2 7u83 250
 
251
#define CHECK_labelled\
252
	node *sh = starter->shape ;\
253
	node *place = places->son ;\
6 7u83 254
	while (place) {\
255
	    sh = lub(sh, place->shape);\
2 7u83 256
	    place = place->bro ;\
257
	}\
6 7u83 258
	exp->shape = normalize(sh);
2 7u83 259
 
260
#define CHECK_last_local\
6 7u83 261
	exp->shape = sh_pointer(al_alloca);\
262
	IGNORE check1(ENC_offset, x);
2 7u83 263
 
264
#define CHECK_local_alloc\
6 7u83 265
	exp->shape = sh_pointer(al_alloca);\
266
	IGNORE check1(ENC_offset, arg1);
2 7u83 267
 
268
#define CHECK_local_alloc_check		CHECK_local_alloc
269
 
270
#define CHECK_local_free\
271
	exp->shape = sh_top ;\
6 7u83 272
	IGNORE check1(ENC_offset, a);\
273
	IGNORE check1(ENC_pointer, p);
2 7u83 274
 
6 7u83 275
#define CHECK_local_free_all		exp->shape = sh_top;
2 7u83 276
 
277
#define CHECK_long_jump\
278
	exp->shape = sh_bottom ;\
6 7u83 279
	IGNORE check1(ENC_pointer, arg1);\
280
	IGNORE check1(ENC_pointer, arg2);
2 7u83 281
 
282
#define CHECK_make_complex\
6 7u83 283
	exp->shape = sh_floating(c);\
284
	IGNORE check1(ENC_floating, arg1);\
285
	IGNORE check1(ENC_floating, arg2);
2 7u83 286
 
287
#define CHECK_make_compound\
6 7u83 288
	exp->shape = sh_compound(arg1);\
289
	IGNORE check1(ENC_offset, arg1);\
290
	UNUSED_ARG(arg2);
2 7u83 291
 
292
#define CHECK_make_floating\
6 7u83 293
	exp->shape = sh_floating(f);\
294
	UNUSED_ARG(base);\
295
	UNUSED_ARG(mantissa);\
296
	UNUSED_ARG(negative);
2 7u83 297
 
298
#define CHECK_make_general_proc\
299
	exp->shape = sh_proc ;\
6 7u83 300
	IGNORE check1(ENC_bottom, body);\
301
	UNUSED_ARG(result_shape);
2 7u83 302
 
6 7u83 303
#define CHECK_make_int			exp->shape = sh_integer(v);
2 7u83 304
 
6 7u83 305
#define CHECK_make_local_lv		exp->shape = sh_pointer(al_code);
2 7u83 306
 
307
#define CHECK_make_nof\
308
	long ns = arg1->cons->encoding ;\
6 7u83 309
	node *sh = checkn(ENC_shape_none, arg1, 0);\
310
	if (sh)exp->shape = sh_nof(make_nat(ns), sh);
2 7u83 311
 
312
#define CHECK_make_nof_int\
6 7u83 313
	node *sh = sh_integer(v);\
314
	exp->shape = sh_nof(string_length(str), sh);
2 7u83 315
 
6 7u83 316
#define CHECK_make_null_local_lv	exp->shape = sh_pointer(al_code);
2 7u83 317
 
6 7u83 318
#define CHECK_make_null_proc		exp->shape = sh_proc;
2 7u83 319
 
6 7u83 320
#define CHECK_make_null_ptr		exp->shape = sh_pointer(a);
2 7u83 321
 
322
#define CHECK_make_proc\
323
	exp->shape = sh_proc ;\
6 7u83 324
	IGNORE check1(ENC_bottom, body);\
325
	UNUSED_ARG(result_shape);
2 7u83 326
 
327
#define CHECK_make_stack_limit\
328
	exp->shape = null ;\
6 7u83 329
	UNUSED_ARG(stack_base);\
330
	UNUSED_ARG(frame_size);\
331
	UNUSED_ARG(alloc_size);
2 7u83 332
 
6 7u83 333
#define CHECK_make_top			exp->shape = sh_top;
2 7u83 334
 
6 7u83 335
#define CHECK_make_value		exp->shape = normalize(s);
2 7u83 336
 
337
#define CHECK_maximum			CHECK_and
338
 
339
#define CHECK_minimum			CHECK_and
340
 
341
#define CHECK_minus			CHECK_and
342
 
343
#define CHECK_move_some\
6 7u83 344
	node *sh1 = check1(ENC_pointer, arg1);\
345
	node *sh2 = check1(ENC_pointer, arg2);\
346
	node *sh3 = check1(ENC_offset, arg3);\
347
	al_includes(ptr_to(sh1), offset_from(sh3));\
348
	al_includes(ptr_to(sh2), offset_to(sh3));\
349
	exp->shape = sh_top;
2 7u83 350
 
351
#define CHECK_mult			CHECK_and
352
 
353
#define CHECK_n_copies\
6 7u83 354
	exp->shape = sh_nof(n, arg1->shape);
2 7u83 355
 
356
#define CHECK_negate\
6 7u83 357
	exp->shape = normalize(check1(ENC_integer, arg1));
2 7u83 358
 
359
#define CHECK_not			CHECK_negate
360
 
6 7u83 361
#define CHECK_obtain_tag		chk_tag(exp, t, 0);
2 7u83 362
 
363
#define CHECK_offset_add\
6 7u83 364
	node *sh1 = check1(ENC_offset, arg1);\
365
	node *sh2 = check1(ENC_offset, arg2);\
366
	al_includes(offset_to(sh1), offset_from(sh2));\
367
	exp->shape = sh_offset(offset_from(sh1), offset_to(sh2));
2 7u83 368
 
369
#define CHECK_offset_div\
6 7u83 370
	node *sh = check2(ENC_offset, arg1, arg2);\
371
	al_equals(offset_from(sh), offset_to(sh));\
372
	exp->shape = sh_integer(v);
2 7u83 373
 
374
#define CHECK_offset_div_by_int\
6 7u83 375
	node *sh1 = check1(ENC_offset, arg1);\
376
	al_equals(offset_from(sh1), offset_to(sh1));\
377
	IGNORE check1(ENC_integer, arg2);\
378
	exp->shape = normalize(sh1);
2 7u83 379
 
380
#define CHECK_offset_max\
6 7u83 381
	node *sh1 = check1(ENC_offset, arg1);\
382
	node *sh2 = check1(ENC_offset, arg2);\
383
	node *al1 = al_union(offset_from(sh1), offset_from(sh2));\
384
	node *al2 = offset_to(sh1);\
385
	al_equals(al2, offset_to(sh2));\
386
	exp->shape = sh_offset(al1, al2);
2 7u83 387
 
388
#define CHECK_offset_mult\
6 7u83 389
	node *sh1 = check1(ENC_offset, arg1);\
390
	al_equals(offset_from(sh1), offset_to(sh1));\
391
	IGNORE check1(ENC_integer, arg2);\
392
	exp->shape = normalize(sh1);
2 7u83 393
 
394
#define CHECK_offset_negate\
6 7u83 395
	node *sh1 = check1(ENC_offset, arg1);\
396
	al_equals(offset_from(sh1), offset_to(sh1));\
397
	exp->shape = normalize(sh1);
2 7u83 398
 
399
#define CHECK_offset_pad\
6 7u83 400
	node *sh1 = check1(ENC_offset, arg1);\
401
	node *al1 = al_union(offset_from(sh1), a);\
402
	exp->shape = sh_offset(al1, offset_to(sh1));
2 7u83 403
 
404
#define CHECK_offset_subtract\
6 7u83 405
	node *sh1 = check1(ENC_offset, arg1);\
406
	node *sh2 = check1(ENC_offset, arg2);\
407
	al_equals(offset_from(sh1), offset_from(sh2));\
408
	exp->shape = sh_offset(offset_to(sh1), offset_to(sh2));
2 7u83 409
 
410
#define CHECK_offset_test\
411
	exp->shape = sh_top ;\
6 7u83 412
	IGNORE check2(ENC_offset, arg1, arg2);
2 7u83 413
 
6 7u83 414
#define CHECK_offset_zero		exp->shape = sh_offset(a, a);
2 7u83 415
 
416
#define CHECK_or			CHECK_and
417
 
418
#define CHECK_plus			CHECK_and
419
 
420
#define CHECK_pointer_test\
421
	exp->shape = sh_top ;\
6 7u83 422
	IGNORE check2(ENC_pointer, arg1, arg2);
2 7u83 423
 
424
#define CHECK_power			CHECK_shift_left
425
 
426
#define CHECK_proc_test\
427
	exp->shape = sh_top ;\
6 7u83 428
	IGNORE check2(ENC_proc, arg1, arg2);
2 7u83 429
 
430
#define CHECK_profile\
431
	exp->shape = sh_top ;\
6 7u83 432
	UNUSED_ARG(uses);
2 7u83 433
 
434
#define CHECK_real_part\
435
	exp->shape = null ;\
6 7u83 436
	UNUSED_ARG(arg1);
2 7u83 437
 
438
#define CHECK_rem0			CHECK_and
439
 
440
#define CHECK_rem1			CHECK_and
441
 
442
#define CHECK_rem2			CHECK_and
443
 
444
#define CHECK_repeat\
6 7u83 445
	exp->shape = normalize(body->shape);\
446
	IGNORE check1(ENC_top, start);
2 7u83 447
 
448
#define CHECK_return\
449
	exp->shape = sh_bottom ;\
6 7u83 450
	UNUSED_ARG(arg1);
2 7u83 451
 
452
#define CHECK_return_to_label\
453
	exp->shape = sh_bottom ;\
6 7u83 454
	UNUSED_ARG(lab_val);
2 7u83 455
 
456
#define CHECK_round_with_mode\
6 7u83 457
	exp->shape = sh_integer(r);\
458
	IGNORE check1(ENC_floating, arg1);
2 7u83 459
 
460
#define CHECK_rotate_left		CHECK_shift_left
461
 
462
#define CHECK_rotate_right		CHECK_shift_left
463
 
464
#define CHECK_sequence\
6 7u83 465
	exp->shape = normalize(result->shape);\
466
	UNUSED_ARG(statements);
2 7u83 467
 
468
#define CHECK_set_stack_limit\
469
	exp->shape = sh_top ;\
6 7u83 470
	UNUSED_ARG(lim);
2 7u83 471
 
472
#define CHECK_shape_offset\
6 7u83 473
	exp->shape = sh_offset(al_shape(s), al_top);
2 7u83 474
 
475
#define CHECK_shift_left\
6 7u83 476
	exp->shape = normalize(check1(ENC_integer, arg1));\
477
	IGNORE check1(ENC_integer, arg2);
2 7u83 478
 
479
#define CHECK_shift_right		CHECK_shift_left
480
 
481
#define CHECK_subtract_ptrs\
6 7u83 482
	node *sh1 = check1(ENC_pointer, arg1);\
483
	node *sh2 = check1(ENC_pointer, arg2);\
484
	exp->shape = sh_offset(ptr_to(sh2), ptr_to(sh1));
2 7u83 485
 
486
#define CHECK_tail_call\
487
	exp->shape = sh_bottom ;\
6 7u83 488
	IGNORE check1(ENC_proc, p);
2 7u83 489
 
490
#define CHECK_untidy_return\
491
	exp->shape = sh_bottom ;\
6 7u83 492
	UNUSED_ARG(arg1);
2 7u83 493
 
494
#define CHECK_variable\
6 7u83 495
	exp->shape = normalize(body->shape);\
496
	chk_tag(exp, name_intro, 1);\
497
	UNUSED_ARG(init);
2 7u83 498
 
499
#define CHECK_xor			CHECK_and