~pac72/ubuntu/lucid/ddd/devel

« back to all changes in this revision

Viewing changes to ddd/Command.h

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Schepler
  • Date: 2004-07-22 03:49:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040722034937-cysl08t1jvba4jrx
Tags: 1:3.3.9-3
USERINFO has been renamed to USERINFO.txt; adjust debian/rules code
to match, to get correct information on the About DDD dialog.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// $Id: Command.h,v 1.17 2001/01/17 13:16:07 zeller Exp $ -*- C++ -*-
 
1
// $Id$ -*- C++ -*-
2
2
// DDD interface to GDB commands
3
3
 
4
4
// Copyright (C) 1996-1997 Technische Universitaet Braunschweig, Germany.
30
30
#ifndef _DDD_Command_h
31
31
#define _DDD_Command_h
32
32
 
33
 
#ifdef __GNUG__
34
 
#pragma interface
35
 
#endif
36
 
 
37
33
#include "GDBAgent.h"
38
34
#include "question.h"           // NO_GDB_ANSWER
39
35
 
93
89
    void remove_destroy_callback();
94
90
 
95
91
public:
96
 
    Command(const string& cmd, Widget w, OQCProc cb, void *d = 0, 
97
 
            bool v = false, bool c = false, int p = COMMAND_PRIORITY_SYSTEM)
98
 
        : command(cmd), origin(w), callback(cb), extra_callback(0), data(d), 
99
 
          echo(v), verbose(v), prompt(v), check(c), 
100
 
          start_undo(!CommandGroup::active || CommandGroup::first_command), 
101
 
          priority(p)
102
 
    {
103
 
        add_destroy_callback();
104
 
        CommandGroup::first_command = false;
105
 
    }
106
 
 
107
 
    Command(const string& cmd, Widget w = 0)
108
 
        : command(cmd), origin(w), callback(0), extra_callback(0), data(0), 
109
 
          echo(true), verbose(true), prompt(true), check(true), 
110
 
          start_undo(!CommandGroup::active || CommandGroup::first_command),
111
 
          priority(COMMAND_PRIORITY_USER)
112
 
    {
113
 
        add_destroy_callback();
114
 
        CommandGroup::first_command = false;
115
 
    }
 
92
#define COMMAND(TYPE) \
 
93
    Command(TYPE cmd, Widget w, OQCProc cb, void *d = 0, \
 
94
            bool v = false, bool c = false, int p = COMMAND_PRIORITY_SYSTEM) \
 
95
        : command(cmd), origin(w), callback(cb), extra_callback(0), data(d), \
 
96
          echo(v), verbose(v), prompt(v), check(c), \
 
97
          start_undo(!CommandGroup::active || CommandGroup::first_command), \
 
98
          priority(p) \
 
99
    { \
 
100
        add_destroy_callback(); \
 
101
        CommandGroup::first_command = false; \
 
102
    }
 
103
 
 
104
    COMMAND(const string&)
 
105
    COMMAND(const char *)
 
106
#undef COMMAND
 
107
 
 
108
#define COMMAND(TYPE) \
 
109
    Command(TYPE cmd, Widget w = 0) \
 
110
        : command(cmd), origin(w), callback(0), extra_callback(0), data(0), \
 
111
          echo(true), verbose(true), prompt(true), check(true), \
 
112
          start_undo(!CommandGroup::active || CommandGroup::first_command), \
 
113
          priority(COMMAND_PRIORITY_USER) \
 
114
    { \
 
115
        add_destroy_callback(); \
 
116
        CommandGroup::first_command = false; \
 
117
    }
 
118
 
 
119
    COMMAND(const string&)
 
120
    COMMAND(const char *)
 
121
#undef COMMAND
116
122
 
117
123
    Command(const Command& c)
118
124
        : command(c.command), origin(c.origin), callback(c.callback),
150
156
        }
151
157
        return *this;
152
158
    }
153
 
    bool operator == (const Command& c)
 
159
    bool operator == (const Command& c) const
154
160
    {
155
161
        return this == &c || 
156
162
            command == c.command 
171
177
extern void gdb_command(const Command& command);
172
178
 
173
179
// Custom calls
174
 
inline void gdb_command(const string& command, Widget origin,
175
 
                        OQCProc callback, void *data = 0, 
176
 
                        bool verbose = false, bool check = false,
177
 
                        int priority = COMMAND_PRIORITY_SYSTEM)
178
 
{
179
 
    gdb_command(Command(command, origin, callback, data, 
180
 
                        verbose, check, priority));
181
 
}
182
 
 
183
 
inline void gdb_command(const string& command, Widget origin = 0)
184
 
{
185
 
    gdb_command(Command(command, origin));
186
 
}
187
 
 
188
 
inline void gdb_batch(const string& command, Widget origin,
189
 
                      OQCProc callback, void *data = 0,
190
 
                      bool verbose = false, bool check = false,
191
 
                      int priority = COMMAND_PRIORITY_BATCH)
192
 
{
193
 
    gdb_command(Command(command, origin, callback, data, 
194
 
                        verbose, check, priority));
195
 
}
196
 
 
197
 
inline void gdb_batch(const string& command, Widget origin = 0)
198
 
{
199
 
    gdb_command(Command(command, origin, OQCProc(0), 0, 
200
 
                        false, true, COMMAND_PRIORITY_BATCH));
201
 
}
 
180
#define COMMAND(TYPE) \
 
181
inline void gdb_command(TYPE command, Widget origin, \
 
182
                        OQCProc callback, void *data = 0, \
 
183
                        bool verbose = false, bool check = false, \
 
184
                        int priority = COMMAND_PRIORITY_SYSTEM) \
 
185
{ \
 
186
    gdb_command(Command(command, origin, callback, data, \
 
187
                        verbose, check, priority)); \
 
188
}
 
189
COMMAND(const char *)
 
190
COMMAND(const string &)
 
191
#undef COMMAND
 
192
 
 
193
#define COMMAND(TYPE) \
 
194
inline void gdb_command(TYPE command, Widget origin = 0) \
 
195
{ \
 
196
    gdb_command(Command(command, origin)); \
 
197
}
 
198
COMMAND(const char *)
 
199
COMMAND(const string &)
 
200
#undef COMMAND
 
201
 
 
202
#define COMMAND(TYPE) \
 
203
inline void gdb_batch(TYPE command, Widget origin, \
 
204
                      OQCProc callback, void *data = 0, \
 
205
                      bool verbose = false, bool check = false, \
 
206
                      int priority = COMMAND_PRIORITY_BATCH) \
 
207
{ \
 
208
    gdb_command(Command(command, origin, callback, data, \
 
209
                        verbose, check, priority)); \
 
210
}
 
211
COMMAND(const char *)
 
212
COMMAND(const string &)
 
213
#undef COMMAND
 
214
 
 
215
#define COMMAND(TYPE) \
 
216
inline void gdb_batch(TYPE command, Widget origin = 0) \
 
217
{ \
 
218
    gdb_command(Command(command, origin, OQCProc(0), 0, \
 
219
                        false, true, COMMAND_PRIORITY_BATCH)); \
 
220
}
 
221
COMMAND(const char *)
 
222
COMMAND(const string &)
 
223
#undef COMMAND
202
224
 
203
225
// True if GDB can run a command
204
226
bool can_do_gdb_command();