1/*
2    Title:  check_objects.h - Validate addresses in objects.
3
4    Copyright (c) 2006, 2012
5        David C. J. Matthews
6
7    This library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Lesser General Public
9    License as published by the Free Software Foundation; either
10    version 2.1 of the License, or (at your option) any later version.
11
12    This library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
16
17    You should have received a copy of the GNU Lesser General Public
18    License along with this library; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
21*/
22
23#ifndef CHECK_OBJECTS_INCLUDED
24#define CHECK_OBJECTS_INCLUDED
25
26#include "globals.h"
27#include "diagnostics.h" // For userOptions
28
29
30extern void DoCheck (const PolyWord pt);
31extern void DoCheckPointer (const PolyWord pt);
32extern void DoCheckObject (const PolyObject *base, POLYUNSIGNED lengthWord);
33extern void DoCheckMemory(void);
34
35#define Check(pt)        {if (debugOptions & DEBUG_CHECK_OBJECTS) DoCheck(pt); }
36#define CheckObject(pt)  {if (debugOptions & DEBUG_CHECK_OBJECTS) DoCheckObject(pt, (pt)->LengthWord()); }
37#define CheckObjectL(pt, l)  {if (debugOptions & DEBUG_CHECK_OBJECTS) DoCheckObject(pt, l); }
38#define CheckPointer(pt) {if (debugOptions & DEBUG_CHECK_OBJECTS) DoCheckPointer(pt); }
39#define CheckMemory() { if (debugOptions & DEBUG_CHECK_OBJECTS) DoCheckMemory(); }
40
41#endif
42