Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino
Contents of /branches/MSVC/src/logging.h
Parent Directory
|
Revision Log
Revision 1663 -
(show annotations)
(download)
(as text)
Tue May 19 18:09:18 2015 UTC (9 years, 10 months ago) by amb
File MIME type: text/x-chdr
File size: 3301 byte(s)
Tue May 19 18:09:18 2015 UTC (9 years, 10 months ago) by amb
File MIME type: text/x-chdr
File size: 3301 byte(s)
Remove <sys/time.h> where not needed at all or when compiling with Microsoft C compiler (in which case add a replacement gettimeofday function) [inspired by patches from Oliver Eichler].
1 | /*************************************** |
2 | Header file for logging function prototypes |
3 | |
4 | Part of the Routino routing software. |
5 | ******************/ /****************** |
6 | This file Copyright 2008-2015 Andrew M. Bishop |
7 | |
8 | This program is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU Affero General Public License as published by |
10 | the Free Software Foundation, either version 3 of the License, or |
11 | (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public License |
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 | ***************************************/ |
21 | |
22 | |
23 | #ifndef LOGGING_H |
24 | #define LOGGING_H /*+ To stop multiple inclusions. +*/ |
25 | |
26 | #include <stdio.h> |
27 | |
28 | #include "typesx.h" |
29 | |
30 | |
31 | /* Data structures */ |
32 | |
33 | /*+ A structure containing a single object as written by the logerror_*() functions. +*/ |
34 | typedef struct _ErrorLogObject |
35 | { |
36 | char type; /*+ The type of the object. +*/ |
37 | |
38 | uint64_t id; /*+ The id of the object. +*/ |
39 | |
40 | uint32_t offset; /*+ The offset of the error message from the beginning of the text file. +*/ |
41 | } |
42 | ErrorLogObject; |
43 | |
44 | |
45 | /* Variables */ |
46 | |
47 | extern int option_loggable; |
48 | extern int option_logtime; |
49 | extern int option_logmemory; |
50 | |
51 | |
52 | /* Runtime progress logging functions in logging.c */ |
53 | |
54 | void printf_program_start(void); |
55 | void printf_program_end(void); |
56 | |
57 | |
58 | #ifdef __GNUC__ |
59 | |
60 | void printf_first(const char *format, ...) __attribute__ ((format (printf, 1, 2))); |
61 | void printf_middle(const char *format, ...) __attribute__ ((format (printf, 1, 2))); |
62 | void printf_last(const char *format, ...) __attribute__ ((format (printf, 1, 2))); |
63 | |
64 | void fprintf_first(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3))); |
65 | void fprintf_middle(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3))); |
66 | void fprintf_last(FILE *file,const char *format, ...) __attribute__ ((format (printf, 2, 3))); |
67 | |
68 | #else |
69 | |
70 | void printf_first(const char *format, ...); |
71 | void printf_middle(const char *format, ...); |
72 | void printf_last(const char *format, ...); |
73 | |
74 | void fprintf_first(FILE *file,const char *format, ...); |
75 | void fprintf_middle(FILE *file,const char *format, ...); |
76 | void fprintf_last(FILE *file,const char *format, ...); |
77 | |
78 | #endif |
79 | |
80 | void log_malloc(void *address,size_t size); |
81 | void log_free(void *address); |
82 | |
83 | void log_mmap(size_t size); |
84 | void log_munmap(size_t size); |
85 | |
86 | |
87 | /* Error logging functions in logerror.c */ |
88 | |
89 | void open_errorlog(const char *filename,int append,int bin); |
90 | void close_errorlog(void); |
91 | |
92 | #ifdef __GNUC__ |
93 | |
94 | void logerror(const char *format, ...) __attribute__ ((format (printf, 1, 2))); |
95 | |
96 | #else |
97 | |
98 | void logerror(const char *format, ...); |
99 | |
100 | #endif |
101 | |
102 | node_t logerror_node (node_t id); |
103 | way_t logerror_way (way_t id); |
104 | relation_t logerror_relation(relation_t id); |
105 | |
106 | |
107 | /* Runtime fatal error assertion in logging.c */ |
108 | |
109 | #define logassert(xx,yy) do { if(!(xx)) _logassert(yy,__FILE__,__LINE__); } while(0) |
110 | |
111 | void _logassert(const char *message,const char *file,int line); |
112 | |
113 | |
114 | #endif /* LOGGING_H */ |