-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlog.h
64 lines (51 loc) · 1.79 KB
/
log.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// log.h
// Tetris
//
// Created by lipeng on 14-5-19.
// Copyright (c) 2014年 lpstudy. All rights reserved.
//
#ifndef Tetris_log_h
#define Tetris_log_h
#include <stdio.h>
#include "cursor.h"
#define log_event (0)
#define log_event_list (0)
#define log_snake_list_node (0)
#define log_snake_list (0)
#define log_snake (0)
#define log_snake_game (0)
#define trace_func(format, ...) printf("[%30s:%3d]: ("format")\n",__func__, __LINE__, ##__VA_ARGS__)
#if (log_event)
#define trace_event(ev) trace_func("id=%d, type=%d, callback=%p", ev->ev_id, ev->ev_type, ev->ev_callback)
#else
#define trace_event(ev)
#endif//log_event
#if (log_event_list)
#define trace_event_list_node(ev_list) trace_func("list_node:%p", ev_list)
#else
#define trace_event_list_node(ev_list)
#endif//log_event_list
#if (log_snake_list_node)
#define trace_snake_list_node(list_node) trace_func("list_node:%p (%d:%d)", list_node, list_node->point.x, list_node->point.y)
#else
#define trace_snake_list_node(list_node)
#endif//log_snake_list_node
#if (log_snake_list)
#define trace_snake_list(list) trace_func("list:%p len:%d", list, list->length)
#else
#define trace_snake_list(list)
#endif//log_snake_list
#if (log_snake)
#define trace_snake(snake) trace_func("snake:%p", snake)
#else
#define trace_snake(snake)
#endif//log_snake
#if (log_snake_game)
#define trace_snake_game(game) trace_func("game:%p", game)
#else
#define trace_snake_game(game)
#endif//log_snake_game
#define trace_func_line(line,format, ...) MOVETO(1,line); printf("[%30s:%3d]: ("format")\n",__func__, __LINE__, ##__VA_ARGS__)
#define trace_func_sg_game(sg_game,format, ...) MOVETO(1,sg_game->sg_size.height+snake_game_title_len+3); printf("[%30s:%3d]: ("format")\n",__func__, __LINE__, ##__VA_ARGS__)
#endif//Tetris_log_h