~ubuntu-branches/debian/sid/geany-plugins/sid

« back to all changes in this revision

Viewing changes to geanygdb/src/gdb-lex.h

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-07-10 22:56:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090710225641-xc1126t7pq0jmpos
Tags: upstream-0.17.1
ImportĀ upstreamĀ versionĀ 0.17.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * gdb-lex.h - A GLib-based parser for GNU debugger machine interface output.
 
3
 * Copyright 2008 Jeff Pohlmeyer <yetanothergeek(at)gmail(dot)com>
 
4
 *
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; either version 2 of the License, or
 
9
 * (at your option) any later version.
 
10
 *
 
11
 *
 
12
 * This program is distributed in the hope that it will be useful,
 
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
15
 * GNU General Public License for more details.
 
16
 *
 
17
 * You should have received a copy of the GNU General Public License along
 
18
 * with this program; if not, write to the Free Software Foundation, Inc.,
 
19
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
20
 *
 
21
 *
 
22
 */
 
23
 
 
24
 
 
25
 
 
26
 
 
27
/*
 
28
  Simply put, the GDB/MI output is parsed into one of three types:
 
29
  anything inside quotes is a string; anything inside curly brackets
 
30
  is a hash table; and anything inside square braces is a list.
 
31
  In some cases list elements are produced by GDB as key-value pairs
 
32
  with duplicate key names for each element. For these cases the
 
33
  key names are safely and silently ignored, only the values are kept.
 
34
*/
 
35
 
 
36
 
 
37
typedef enum
 
38
{ vt_STRING, vt_HASH, vt_LIST } GdbLxValueType;
 
39
 
 
40
typedef struct
 
41
{
 
42
        GdbLxValueType type;
 
43
        union
 
44
        {
 
45
                gpointer data;
 
46
                gchar *string;
 
47
                GHashTable *hash;
 
48
                GSList *list;
 
49
        };
 
50
} GdbLxValue;
 
51
 
 
52
 
 
53
 
 
54
GHashTable *gdblx_parse_results(gchar * resutls);
 
55
 
 
56
/*
 
57
  The gdblx_lookup_* functions below return NULL if their hash is NULL,
 
58
  if the key is not found, or if its value is not of the expected
 
59
  return type.
 
60
*/
 
61
gchar *gdblx_lookup_string(GHashTable * hash, gchar * key);
 
62
GHashTable *gdblx_lookup_hash(GHashTable * hash, gchar * key);
 
63
GSList *gdblx_lookup_list(GHashTable * hash, gchar * key);
 
64
 
 
65
/*
 
66
  Returns TRUE if hash is not NULL, key exists, and key type is vt_STRING,
 
67
  and the key's value matches 'expected'.
 
68
*/
 
69
gboolean gdblx_check_keyval(GHashTable * hash, gchar * key, gchar * expected);
 
70
 
 
71
 
 
72
/* Dumps a pretty-printed representation of the hash table to stderr */
 
73
void gdblx_dump_table(GHashTable * hash);
 
74
 
 
75
 
 
76
 
 
77
/*
 
78
  The global scanner object is automatically intialized as soon
 
79
  as it is needed, but it must be explicitly destroyed.
 
80
*/
 
81
void gdblx_scanner_done();