~laney/ubuntu/quantal/swig2.0/guile-2.0

« back to all changes in this revision

Viewing changes to Source/Modules/utils.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Landschoff
  • Date: 2010-12-19 18:25:59 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101219182559-8lh77o66bo890jwo
Tags: 2.0.1-1
* Merge new upstream release 2.0.1.
* Remove dependency on quilt and usage in debian/rules, the new source
  format will take care of that.
* Remove patch fix-cleaning.diff (applied upstream).
* Remove patch keep_docs.diff (applied upstream).

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 * Various utility functions.
12
12
 * ----------------------------------------------------------------------------- */
13
13
 
14
 
char cvsroot_utils_cxx[] = "$Id: utils.cxx 11876 2010-02-27 23:53:33Z wsfulton $";
 
14
char cvsroot_utils_cxx[] = "$Id: utils.cxx 12221 2010-09-15 20:17:11Z wsfulton $";
15
15
 
16
16
#include <swigmod.h>
17
17
 
100
100
      Delattr(n, "sym:overloaded");
101
101
  }
102
102
}
 
103
 
 
104
/* -----------------------------------------------------------------------------
 
105
 * Swig_set_max_hash_expand()
 
106
 *
 
107
 * Controls how many Hash objects are displayed when displaying nested Hash objects.
 
108
 * Makes DohSetMaxHashExpand an externally callable function (for debugger).
 
109
 * ----------------------------------------------------------------------------- */
 
110
 
 
111
void Swig_set_max_hash_expand(int count) {
 
112
  SetMaxHashExpand(count);
 
113
}
 
114
 
 
115
extern "C" {
 
116
 
 
117
/* -----------------------------------------------------------------------------
 
118
 * Swig_get_max_hash_expand()
 
119
 *
 
120
 * Returns how many Hash objects are displayed when displaying nested Hash objects.
 
121
 * Makes DohGetMaxHashExpand an externally callable function (for debugger).
 
122
 * ----------------------------------------------------------------------------- */
 
123
 
 
124
int Swig_get_max_hash_expand() {
 
125
  return GetMaxHashExpand();
 
126
}
 
127
 
 
128
/* -----------------------------------------------------------------------------
 
129
 * Swig_to_doh_string()
 
130
 *
 
131
 * DOH version of Swig_to_string()
 
132
 * ----------------------------------------------------------------------------- */
 
133
 
 
134
static String *Swig_to_doh_string(DOH *object, int count) {
 
135
  int old_count = Swig_get_max_hash_expand();
 
136
  if (count >= 0)
 
137
    Swig_set_max_hash_expand(count);
 
138
 
 
139
  String *debug_string = object ? NewStringf("%s", object) : NewString("NULL");
 
140
 
 
141
  Swig_set_max_hash_expand(old_count);
 
142
  return debug_string;
 
143
}
 
144
 
 
145
/* -----------------------------------------------------------------------------
 
146
 * Swig_to_doh_string_with_location()
 
147
 *
 
148
 * DOH version of Swig_to_string_with_location()
 
149
 * ----------------------------------------------------------------------------- */
 
150
 
 
151
static String *Swig_to_doh_string_with_location(DOH *object, int count) {
 
152
  int old_count = Swig_get_max_hash_expand();
 
153
  if (count >= 0)
 
154
    Swig_set_max_hash_expand(count);
 
155
 
 
156
  String *debug_string = Swig_stringify_with_location(object);
 
157
 
 
158
  Swig_set_max_hash_expand(old_count);
 
159
  return debug_string;
 
160
}
 
161
 
 
162
/* -----------------------------------------------------------------------------
 
163
 * Swig_to_string()
 
164
 *
 
165
 * Swig debug - return C string representation of any DOH type.
 
166
 * Nested Hash types expand count is value of Swig_get_max_hash_expand when count<0
 
167
 * Note: leaks memory.
 
168
 * ----------------------------------------------------------------------------- */
 
169
 
 
170
const char *Swig_to_string(DOH *object, int count) {
 
171
  return Char(Swig_to_doh_string(object, count));
 
172
}
 
173
 
 
174
/* -----------------------------------------------------------------------------
 
175
 * Swig_to_string_with_location()
 
176
 *
 
177
 * Swig debug - return C string representation of any DOH type, within [] brackets
 
178
 * for Hash and List types, prefixed by line and file information.
 
179
 * Nested Hash types expand count is value of Swig_get_max_hash_expand when count<0
 
180
 * Note: leaks memory.
 
181
 * ----------------------------------------------------------------------------- */
 
182
 
 
183
const char *Swig_to_string_with_location(DOH *object, int count) {
 
184
  return Char(Swig_to_doh_string_with_location(object, count));
 
185
}
 
186
 
 
187
/* -----------------------------------------------------------------------------
 
188
 * Swig_print()
 
189
 *
 
190
 * Swig debug - display string representation of any DOH type.
 
191
 * Nested Hash types expand count is value of Swig_get_max_hash_expand when count<0
 
192
 * ----------------------------------------------------------------------------- */
 
193
 
 
194
void Swig_print(DOH *object, int count) {
 
195
  String *output = Swig_to_doh_string(object, count);
 
196
  Printf(stdout, "%s\n", output);
 
197
  Delete(output);
 
198
}
 
199
 
 
200
/* -----------------------------------------------------------------------------
 
201
 * Swig_to_string_with_location()
 
202
 *
 
203
 * Swig debug - display string representation of any DOH type, within [] brackets
 
204
 * for Hash and List types, prefixed by line and file information.
 
205
 * Nested Hash types expand count is value of Swig_get_max_hash_expand when count<0
 
206
 * ----------------------------------------------------------------------------- */
 
207
 
 
208
void Swig_print_with_location(DOH *object, int count) {
 
209
  String *output = Swig_to_doh_string_with_location(object, count);
 
210
  Printf(stdout, "%s\n", output);
 
211
  Delete(output);
 
212
}
 
213
 
 
214
} // extern "C"
 
215