summaryrefslogtreecommitdiff
path: root/src/test.c
blob: cd71879fd271a65ef7a87f9207027d528646b1a1 (plain)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/* Copyright (C) 2009 David Zeuthen <zeuthen@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author: David Zeuthen <zeuthen@gmail.com>
 */

#include "config.h"

#include <glib.h>

#include "dbusidl.h"

static gboolean
pof (const gchar *path)
{
  DIParser *parser;
  gboolean ret;
  GList *l;
  const gchar *files[2];

  files[0] = path;
  files[1] = NULL;

  ret = FALSE;

  parser = di_parser_new ((gchar **) files);

  for (l = di_parser_get_errors (parser); l != NULL; l = l->next)
    {
      const gchar *message = l->data;
      g_printerr ("%s\n", message);
    }

  for (l = di_parser_get_warnings (parser); l != NULL; l = l->next)
    {
      const gchar *message = l->data;
      g_printerr ("%s\n", message);
    }

  ret = (di_parser_get_errors (parser) == NULL);
  if (!ret)
    goto out;


  for (l = di_parser_get_interfaces (parser); l != NULL; l = l->next)
    {
      DIInterface *interface = l->data;
      di_interface_print (interface, 0);
    }
  for (l = di_parser_get_structs (parser); l != NULL; l = l->next)
    {
      DIStruct *struct_ = l->data;
      di_struct_print (struct_, 0);
    }
  for (l = di_parser_get_enums (parser); l != NULL; l = l->next)
    {
      DIEnum *enum_ = l->data;
      di_enum_print (enum_, 0);
    }
  for (l = di_parser_get_error_domains (parser); l != NULL; l = l->next)
    {
      DIErrorDomain *error_domain = l->data;
      di_error_domain_print (error_domain, 0);
    }

 out:
  di_parser_free (parser);
  return ret;
}

int
main (int argc, char *argv[])
{
  /* TODO: actually compare di_namespace_print() output and di_parser_get_errors/warnings() with
   * something
   */
  pof ("org.freedesktop.DBus.Idl.Tests1.didl");
  return 0;
}