~ubuntu-branches/ubuntu/raring/sip-tester/raring

« back to all changes in this revision

Viewing changes to screen.hpp

  • Committer: Bazaar Package Importer
  • Author(s): ARAKI Yasuhiro
  • Date: 2005-04-11 11:53:53 UTC
  • Revision ID: james.westby@ubuntu.com-20050411115353-o33qn3noyjwjgnpd
Tags: upstream-1.1rc1
ImportĀ upstreamĀ versionĀ 1.1rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  This program is free software; you can redistribute it and/or modify
 
3
 *  it under the terms of the GNU General Public License as published by
 
4
 *  the Free Software Foundation; either version 2 of the License, or
 
5
 *  (at your option) any later version.
 
6
 *
 
7
 *  This program is distributed in the hope that it will be useful,
 
8
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
 *  GNU General Public License for more details.
 
11
 *
 
12
 *  You should have received a copy of the GNU General Public License
 
13
 *  along with this program; if not, write to the Free Software
 
14
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
 *
 
16
 *  Copyright (C) 2003 - The Authors
 
17
 *
 
18
 *  Author : Richard GAYRAUD - 04 Nov 2003
 
19
 *           From Hewlett Packard Company.
 
20
 */
 
21
 
 
22
/****
 
23
 * Screen.hpp : Simple curses & logfile encapsulation 
 
24
 */
 
25
 
 
26
#ifndef __SCREEN_H__
 
27
#define __SCREEN_H__
 
28
 
 
29
#include <stdio.h>
 
30
 
 
31
void _screen_error(char *s, int fatal);
 
32
extern char _screen_err[32768];
 
33
 
 
34
#define OUTPUT_P3(s, p1, p2, p3, fatal) {     \
 
35
  sprintf(_screen_err, s, p1, p2, p3);        \
 
36
  _screen_error((char *)_screen_err , fatal); \
 
37
}
 
38
 
 
39
#define ERROR_P3(s, p1, p2, p3) OUTPUT_P3(s, p1, p2, p3, 1)
 
40
#define ERROR_P2(s, p1, p2)     ERROR_P3(s, p1, p2, 0)
 
41
#define ERROR_P1(s, p)          ERROR_P2(s, p, 0)
 
42
#define ERROR(s)                ERROR_P1("%s", s)
 
43
#define ERROR_NO(s) \
 
44
        ERROR_P3("%s, errno = %d (%s)", s, errno, strerror(errno))
 
45
 
 
46
#define WARNING_P3(s, p1, p2, p3) OUTPUT_P3(s, p1, p2, p3, 0)
 
47
#define WARNING_P2(s, p1, p2)     WARNING_P3(s, p1, p2, 0)
 
48
#define WARNING_P1(s, p)          WARNING_P2(s, p, 0)
 
49
#define WARNING(s)                WARNING_P1("%s", s)
 
50
#define WARNING_NO(s) \
 
51
        WARNING_P3("%s, errno = %d (%s)", s, errno, strerror(errno))
 
52
 
 
53
#define EXIT_TEST_OK               0
 
54
#define EXIT_TEST_FAILED           1
 
55
#define EXIT_TEST_RES_INTERNAL     97
 
56
#define EXIT_TEST_RES_UNKNOWN      98
 
57
#define EXIT_OTHER                 99
 
58
#define EXIT_FATAL_ERROR           -1
 
59
 
 
60
void screen_set_exename(char * exe_name);
 
61
void screen_init(char *logfile_name, void (*exit_handler)());
 
62
void screen_clear();
 
63
int  screen_readkey();
 
64
void screen_exit(int rc);
 
65
void screen_sigusr1(int /* not used */);
 
66
 
 
67
#endif // __SCREEN_H__
 
68