cfad47cfa3/t3compiler/tads3/tchost.h

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
/* $Header: d:/cvsroot/tads/tads3/TCHOST.H,v 1.2 1999/05/17 02:52:27 MJRoberts Exp $ */
2
3
/* 
4
 *   Copyright (c) 1999, 2002 Michael J. Roberts.  All Rights Reserved.
5
 *   
6
 *   Please see the accompanying license file, LICENSE.TXT, for information
7
 *   on using and copying this software.  
8
 */
9
/*
10
Name
11
  tchost.h - TADS 3 Compiler Host System Interface
12
Function
13
  The host system interface is an abstract interface to services
14
  provided by the compiler host system.
15
Notes
16
  
17
Modified
18
  04/22/99 MJRoberts  - Creation
19
*/
20
21
#ifndef TCHOST_H
22
#define TCHOST_H
23
24
#include <stdarg.h>
25
#include "tcerr.h"
26
27
/* ------------------------------------------------------------------------ */
28
/*
29
 *   Abstract Host Interface 
30
 */
31
class CTcHostIfc
32
{
33
public:
34
    virtual ~CTcHostIfc() { }
35
36
    /* 
37
     *   Display a message, taking varargs parameters.  The message is a
38
     *   UTF-8 string.  The message string is a printf-style format
39
     *   string.  This is used to display informational messages.  
40
     */
41
    void print_msg(const char *msg, ...)
42
    {
43
        va_list args;
44
45
        va_start(args, msg);
46
        v_print_msg(msg, args);
47
        va_end(args);
48
    }
49
50
    /* display a message with va_list-style varargs */
51
    virtual void v_print_msg(const char *msg, va_list args) = 0;
52
53
    /*
54
     *   Display a process step message.  These work the same as
55
     *   print_msg() and v_print_msg(), respectively, but display a
56
     *   message indicating a process step.  Some implementations might
57
     *   want to display process step messages in a special manner; for
58
     *   example, a GUI implementation might put the message in a status
59
     *   bar or similar type of display rather than intermixed with other
60
     *   messages.  
61
     */
62
    void print_step(const char *msg, ...)
63
    {
64
        va_list args;
65
66
        va_start(args, msg);
67
        v_print_step(msg, args);
68
        va_end(args);
69
    }
70
71
    /* display a process step message with va_list-style varargs */
72
    virtual void v_print_step(const char *msg, va_list args) = 0;
73
74
    /* 
75
     *   Display an error message.  These work the same way as print_msg()
76
     *   and v_print_msg(), respectively, but display error messages
77
     *   instead of informational messages.  Some implementations might
78
     *   want to direct the different types of messages to different
79
     *   places; for example, a stdio implementation may want to send
80
     *   print_msg messages to stdout, but print_err messages to stderr.  
81
     */
82
    void print_err(const char *msg, ...)
83
    {
84
        va_list args;
85
86
        va_start(args, msg);
87
        v_print_err(msg, args);
88
        va_end(args);
89
    }
90
91
    /* display an error with va_list arguments */
92
    virtual void v_print_err(const char *msg, va_list args) = 0;
93
};
94
95
96
#endif /* TCHOST_H */
97