aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/jabber/log.c
blob: 86d19e1ddb76fd5403183762314fc900f7646b02 (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
/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program 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 General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 *  Jabber
 *  Copyright (C) 1998-1999 The Jabber Team http://jabber.org/
 */

#include "jabber.h"
#include "log.h"

#ifdef DEBUG

void jdebug(char *zone, const char *msgfmt, ...)
{
    va_list ap;
    static char loghdr[LOGSIZE_HDR];
    static char logmsg[LOGSIZE_TAIL];
    static int size;

    /* XXX: We may want to check the sizes eventually */
    size = g_snprintf(loghdr, LOGSIZE_HDR, "debug/%s %s\n", zone, msgfmt);

    va_start(ap, msgfmt);
    size = vsnprintf(logmsg, LOGSIZE_TAIL, loghdr, ap);

    fprintf(stderr,"%s",logmsg);

    return;
}


#endif  /* DEBUG */
a href='/mirrors/MimesBronn/alaveteli/tree/vendor/gems?h=hotfix/0.18.0.4&id=92fea9c55d70701f801cc860553ee4a8d451efce'>gems/rdoc-2.4.3/lib/rdoc/ri/reader.rb
blob: de3c8d9afadbee8ea79a7b6ea325e1c52df42298 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
require 'rdoc/ri'
require 'rdoc/ri/descriptions'
require 'rdoc/ri/writer'
require 'rdoc/markup/to_flow'

class RDoc::RI::Reader

  def initialize(ri_cache)
    @cache = ri_cache
  end

  def top_level_namespace
    [ @cache.toplevel ]
  end

  def lookup_namespace_in(target, namespaces)
    result = []
    for n in namespaces
      result.concat(n.contained_modules_matching(target))
    end
    result
  end

  def find_class_by_name(full_name)
    names = full_name.split(/::/)
    ns = @cache.toplevel
    for name in names
      ns = ns.contained_class_named(name)
      return nil if ns.nil?
    end
    get_class(ns)
  end

  def find_methods(name, is_class_method, namespaces)
    result = []
    namespaces.each do |ns|
      result.concat ns.methods_matching(name, is_class_method)
    end
    result
  end

  ##
  # Return the MethodDescription for a given MethodEntry by deserializing the
  # YAML

  def get_method(method_entry)
    path = method_entry.path_name
    File.open(path) { |f| RDoc::RI::Description.deserialize(f) }
  end

  ##
  # Return a class description

  def get_class(class_entry)
    result = nil
    for path in class_entry.path_names
      path = RDoc::RI::Writer.class_desc_path(path, class_entry)
      desc = File.open(path) {|f| RDoc::RI::Description.deserialize(f) }
      if result
        result.merge_in(desc)
      else
        result = desc
      end
    end
    result
  end

  ##
  # Return the names of all classes and modules

  def full_class_names
    res = []
    find_classes_in(res, @cache.toplevel)
  end

  ##
  # Return a list of all classes, modules, and methods

  def all_names
    res = []
    find_names_in(res, @cache.toplevel)
  end

  private

  def find_classes_in(res, klass)
    classes = klass.classes_and_modules
    for c in classes
      res << c.full_name
      find_classes_in(res, c)
    end
    res
  end

  def find_names_in(res, klass)
    classes = klass.classes_and_modules
    for c in classes
      res << c.full_name
      res.concat c.all_method_names
      find_names_in(res, c)
    end
    res
  end

end