ACT-CV - Machine Vision for Cognitive Modeling
mhexcptn.h
Go to the documentation of this file.
1 // -*- mode: c++; indent-tabs-mode: nil; c-basic-offset: 4; coding: iso-8859-1; -*-
2 
3 /*
4 ACT-CV - Machine Vision for Cognitive Modeling
5 Copyright (c) 2008 Marc Halbruegge
6 
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11 
12 This program 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
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21 
22 
29 #ifndef __MHEXCPTN_H
30 #define __MHEXCPTN_H
31 
32 #include <string.h>
33 
34 #ifdef _MSC_VER
35 #define __PRETTY_FUNCTION__ ""
36 #endif
37 
38 #ifdef DEBUG
39 #undef NDEBUG
40 #endif
41 
42 // MH: simple debug stuff
43 #ifndef NDEBUG
44 # include <stdio.h>
45 # define MHDBGMSG(f,l,msg) printf("(DEBUG) %s (%i): %s\n",f,l,msg)
46 # define MHDBGMSG_P(f,l,s,p) printf("(DEBUG) %s (%i): %s %p\n",f,l,s,p)
47 # define MHDBGMSG_I(f,l,s,i) printf("(DEBUG) %s (%i): %s %i\n",f,l,s,i)
48 # define MHDBGMSG_MEM(f,l,p,blocks) \
49  {printf("(DEBUG) %s %i: memdump %p\n",f,l,p); \
50  for (int i=0;i<blocks;i++) printf("%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", \
51  *(p+0+i*16), *(p+1+i*16), *(p+2+i*16), *(p+3+i*16), *(p+4+i*16), *(p+5+i*16), *(p+6+i*16), *(p+7+i*16), *(p+8+i*16), *(p+9+i*16), *(p+10+i*16), *(p+11+i*16), *(p+12+i*16), *(p+13+i*16), *(p+14+i*16), *(p+15+i*16));\
52  }
53 #else
54 # define MHDBGMSG(f,l,msg)
55 # define MHDBGMSG_P(f,l,s,p)
56 # define MHDBGMSG_I(f,l,s,i)
57 # define MHDBGMSG_MEM(f,l,p,blocks)
58 #endif
59 
65 public:
66  int line;
67  LineException(int l) : line(l) {}
68 };
69 
70 
75  char buf[10240];
76 public:
77  FileLineException(const char *s, int l) : LineException(l) {
78  strncpy(buf, s, 10239);
79  buf[10239]=0;
80  }
81  const char* GetFile() const {
82  return buf;
83  }
84 };
85 
86 #endif


ACT-CV - Machine Vision for Cognitive Modeling
© 2015 Marc Halbruegge (actcvlibrary@googlemail.com)