/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk
43 by Gustav Hartvigsson
* Code cleanup
1
#include "Box.h"
49 by Gustav Hartvigsson
* started work SBox (Untested).
2
#include <stdlib.h>
3
61 by Gustav Hartvigsson
* Made the code more easy to read.
4
struct
5
SBoxPrivate {
49 by Gustav Hartvigsson
* started work SBox (Untested).
6
  sboolean                      free_data;
7
  SType                         object_type;
62 by Gustav Hartvigsson
* General documentation clean up.
8
  FreeFunc                      free_func;
9
  union {
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
10
    SObject *                    m_sobject;
11
    spointer                     m_ptr;
12
    sboolean                     m_sboolean;
13
    sint                         m_int;
14
    slong                        m_long;
15
    sshort                       m_short;
16
    schar                        m_char;
151.1.2 by Gustav Hartvigsson
* Removed wchar.
17
    #if 0
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
18
    wchar_t                      m_wchar; /*< @depricated */
151.1.2 by Gustav Hartvigsson
* Removed wchar.
19
    #endif
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
20
    suchar                       m_uchar;
21
    suint                        m_uint;
22
    sulong                       m_ulong;
23
    sushort                      m_ushort;
24
    schar *                      m_string;
151.1.2 by Gustav Hartvigsson
* Removed wchar.
25
    #if 0
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
26
    wchar_t *                    m_wstring; /*< @depricated */
151.1.2 by Gustav Hartvigsson
* Removed wchar.
27
    #endif
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
28
    suchar *                     m_ustring;
62 by Gustav Hartvigsson
* General documentation clean up.
29
  } data;
49 by Gustav Hartvigsson
* started work SBox (Untested).
30
};
31
61 by Gustav Hartvigsson
* Made the code more easy to read.
32
void
33
s_method_box_free (SBox * self);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
34
char *
35
s_method_box_to_string (SBox * self);
49 by Gustav Hartvigsson
* started work SBox (Untested).
36
37
/* Private function to allocate and set methods to the SBox.
38
 */
61 by Gustav Hartvigsson
* Made the code more easy to read.
39
SBox *
40
internal_s_box_new () {
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
41
  SBox * self = s_malloc (sizeof (SBox));
42
  SBoxClass * klass = s_malloc (sizeof (SBoxClass));
49 by Gustav Hartvigsson
* started work SBox (Untested).
43
  s_object_initialize (S_OBJECT (self), "SBox");
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
44
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
45
  s_object_set_class (S_OBJECT (self),
46
                      S_OBJECT_CLASS (klass));
47
  s_object_set_free_method (S_OBJECT (self),
48
                            FREE_METHOD (s_method_box_free));
49
  s_object_set_to_string_method (S_OBJECT (self),
50
                                 TO_STRING_FUNC (s_method_box_to_string));
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
51
62 by Gustav Hartvigsson
* General documentation clean up.
52
  self->priv->free_func = NULL;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
53
62 by Gustav Hartvigsson
* General documentation clean up.
54
  return self;
55
}
56
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
57
/* set the error if
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
58
 */
59
void
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
60
_internal_s_box_set_err_on_missmatch (SBox * self,
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
61
                                     SType expeted_type,
62
                                     SError * err) {
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
63
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
64
  assert (err != NULL);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
65
  if (self->priv->object_type != expeted_type) {
104 by Gustav Hartvigsson
* Passing arguments can not be initialised from within a function...
66
    s_error_append (err, S_ERROR_TYPE_ERROR, s_string_new_fmt (
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
67
                                    "(SBox) Type missmatch:\n"
68
                                    "Expected type: %s"
69
                                    "Type held: %s",
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
70
                                    s_type_get_name (expeted_type),
71
                                    s_type_get_name (self->priv->object_type)
72
                                    ),
73
                                    S_ERROR_GET_DEFAULT_DOMAIN);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
74
  }
75
}
76
62 by Gustav Hartvigsson
* General documentation clean up.
77
SBox *
78
s_box_new_pointer (spointer object) {
79
  SBox * self = internal_s_box_new ();
80
  self->priv->data.m_ptr = object;
81
  self->priv->object_type = S_TYPE_POINTER;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
82
62 by Gustav Hartvigsson
* General documentation clean up.
83
  return self;
84
}
85
86
SBox *
87
s_box_new_sobject (SObject * object) {
88
  SBox * self = internal_s_box_new ();
89
  self->priv->data.m_sobject = object;
90
  self->priv->object_type = S_TYPE_OBJECT;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
91
62 by Gustav Hartvigsson
* General documentation clean up.
92
  return self;
93
}
94
95
SBox *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
96
s_box_new_int (sint i) {
62 by Gustav Hartvigsson
* General documentation clean up.
97
  SBox * self = internal_s_box_new ();
98
  self->priv->data.m_int = i;
99
  self->priv->object_type = S_TYPE_INT;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
100
62 by Gustav Hartvigsson
* General documentation clean up.
101
  return self;
102
}
103
104
SBox *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
105
s_box_new_long (slong l) {
62 by Gustav Hartvigsson
* General documentation clean up.
106
  SBox * self = internal_s_box_new ();
107
  self->priv->data.m_long = l;
108
  self->priv->object_type = S_TYPE_LONG;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
109
62 by Gustav Hartvigsson
* General documentation clean up.
110
  return self;
111
}
112
113
SBox *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
114
s_box_new_short (sshort s) {
62 by Gustav Hartvigsson
* General documentation clean up.
115
  SBox * self = internal_s_box_new ();
116
  self->priv->data.m_short = s;
117
  self->priv->object_type = S_TYPE_SHORT;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
118
62 by Gustav Hartvigsson
* General documentation clean up.
119
  return self;
120
}
121
122
SBox *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
123
s_box_new_char (schar c) {
62 by Gustav Hartvigsson
* General documentation clean up.
124
  SBox * self = internal_s_box_new ();
125
  self->priv->data.m_char = c;
126
  self->priv->object_type = S_TYPE_CHAR;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
127
62 by Gustav Hartvigsson
* General documentation clean up.
128
  return self;
129
}
130
151.1.2 by Gustav Hartvigsson
* Removed wchar.
131
#if 0
62 by Gustav Hartvigsson
* General documentation clean up.
132
SBox *
133
s_box_new_wchar (wchar_t wc) {
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
134
62 by Gustav Hartvigsson
* General documentation clean up.
135
  SBox * self = internal_s_box_new ();
136
  self->priv->data.m_wchar = wc;
137
  self->priv->object_type = S_TYPE_WCHAR;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
138
62 by Gustav Hartvigsson
* General documentation clean up.
139
  return self;
140
}
151.1.2 by Gustav Hartvigsson
* Removed wchar.
141
#endif
62 by Gustav Hartvigsson
* General documentation clean up.
142
143
SBox *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
144
s_box_new_uint (suint ui) {
62 by Gustav Hartvigsson
* General documentation clean up.
145
  SBox * self = internal_s_box_new ();
146
  self->priv->data.m_uint = ui;
147
  self->priv->object_type = S_TYPE_UINT;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
148
62 by Gustav Hartvigsson
* General documentation clean up.
149
  return self;
150
}
151
152
153
SBox *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
154
s_box_new_ulong (sulong ul) {
62 by Gustav Hartvigsson
* General documentation clean up.
155
  SBox * self = internal_s_box_new ();
156
  self->priv->data.m_ulong = ul;
157
  self->priv->object_type = S_TYPE_ULONG;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
158
62 by Gustav Hartvigsson
* General documentation clean up.
159
  return self;
160
}
161
162
SBox *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
163
s_box_new_ushort (sushort us)  {
62 by Gustav Hartvigsson
* General documentation clean up.
164
  SBox * self = internal_s_box_new ();
165
  self->priv->data.m_ushort = us;
166
  self->priv->object_type = S_TYPE_USHORT;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
167
62 by Gustav Hartvigsson
* General documentation clean up.
168
  return self;
169
}
170
171
SBox *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
172
s_box_new_string (schar * s) {
62 by Gustav Hartvigsson
* General documentation clean up.
173
  SBox * self = internal_s_box_new ();
174
  self->priv->data.m_string = s;
175
  self->priv->object_type = S_TYPE_STRING;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
176
62 by Gustav Hartvigsson
* General documentation clean up.
177
  return self;
178
}
179
151.1.2 by Gustav Hartvigsson
* Removed wchar.
180
#if 0
62 by Gustav Hartvigsson
* General documentation clean up.
181
SBox *
182
s_box_new_wstring (wchar_t * ws) {
183
  SBox * self = internal_s_box_new ();
184
  self->priv->data.m_wstring = ws;
185
  self->priv->object_type = S_TYPE_WSTRING;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
186
62 by Gustav Hartvigsson
* General documentation clean up.
187
  return self;
188
}
151.1.2 by Gustav Hartvigsson
* Removed wchar.
189
#endif
61 by Gustav Hartvigsson
* Made the code more easy to read.
190
191
void
192
s_box_free (SBox * self) {
49 by Gustav Hartvigsson
* started work SBox (Untested).
193
  s_object_free (S_OBJECT (self));
194
}
195
61 by Gustav Hartvigsson
* Made the code more easy to read.
196
void
197
s_box_set_free_data_on_free (SBox * self, sboolean free_data) {
62 by Gustav Hartvigsson
* General documentation clean up.
198
  self->priv->free_data = free_data;
49 by Gustav Hartvigsson
* started work SBox (Untested).
199
}
200
61 by Gustav Hartvigsson
* Made the code more easy to read.
201
void
202
s_box_set_free_func (SBox * self, FreeFunc free_func) {
62 by Gustav Hartvigsson
* General documentation clean up.
203
  self->priv->free_func = free_func;
49 by Gustav Hartvigsson
* started work SBox (Untested).
204
}
205
62 by Gustav Hartvigsson
* General documentation clean up.
206
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
207
208
/* *********************
209
   ****** Getters ******
210
   ********************* */
62 by Gustav Hartvigsson
* General documentation clean up.
211
spointer *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
212
s_box_get_pointer (SBox * self, SError * err) {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
213
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_POINTER, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
214
  if (err) {
215
    return NULL;
216
  }
217
  return self->priv->data.m_ptr;
218
}
62 by Gustav Hartvigsson
* General documentation clean up.
219
220
SObject *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
221
s_box_get_sobject (SBox * self, SError * err) {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
222
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_OBJECT, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
223
  if (err) {
224
    return NULL;
225
  }
226
  return self->priv->data.m_sobject;
227
}
228
229
230
sint
231
s_box_get_int (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
232
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_INT, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
233
  if (err) {
234
    return 0;
235
  }
236
  return self->priv->data.m_int;
237
}
238
239
240
slong
241
s_box_get_long (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
242
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_LONG, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
243
  if (err) {
244
    return 0;
245
  }
246
  return self->priv->data.m_long;
247
}
248
249
sshort
250
s_box_get_short (SBox * self, SError * err) {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
251
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_SHORT, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
252
  if (err) {
253
    return 0;
254
  }
255
  return self->priv->data.m_short;
256
}
257
258
schar
259
s_box_get_char (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
260
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_CHAR, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
261
  if (err) {
262
    return 0;
263
  }
264
  return self->priv->data.m_char;
265
}
62 by Gustav Hartvigsson
* General documentation clean up.
266
151.1.2 by Gustav Hartvigsson
* Removed wchar.
267
#if 0
62 by Gustav Hartvigsson
* General documentation clean up.
268
wchar_t
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
269
s_box_get_wchar (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
270
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_WCHAR, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
271
  if (err) {
272
    return 0;
273
  }
274
  return self->priv->data.m_wchar;
275
}
151.1.2 by Gustav Hartvigsson
* Removed wchar.
276
#endif
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
277
278
suint
279
s_box_get_uint (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
280
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_UINT, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
281
  if (err) {
282
    return 0;
283
  }
284
  return self->priv->data.m_uint;
285
}
286
287
sulong
288
s_box_get_ulong (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
289
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_ULONG, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
290
  if (err) {
291
    return 0;
292
  }
293
  return self->priv->data.m_ulong;
294
}
295
296
sushort
297
s_box_get_ushort (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
298
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_USHORT, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
299
  if (err) {
300
    return 0;
301
  }
302
  return self->priv->data.m_ushort;
303
}
304
305
schar *
306
s_box_get_string (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
307
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_STRING, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
308
  if (err) {
309
    return NULL;
310
  }
311
  return self->priv->data.m_string;
312
}
62 by Gustav Hartvigsson
* General documentation clean up.
313
151.1.2 by Gustav Hartvigsson
* Removed wchar.
314
#if 0
62 by Gustav Hartvigsson
* General documentation clean up.
315
wchar_t *
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
316
s_box_get_wstring (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
317
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_WSTRING, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
318
  if (err) {
319
    return NULL;
320
  }
321
  return self->priv->data.m_wstring;
322
}
151.1.2 by Gustav Hartvigsson
* Removed wchar.
323
#endif
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
324
325
suchar *
326
s_box_get_ustring (SBox * self, SError * err)  {
119 by Gustav Hartvigsson
* added S_EXPERTED to public functions.
327
  _internal_s_box_set_err_on_missmatch (self, S_TYPE_USTRING, err);
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
328
  if (err) {
329
    return NULL;
330
  }
331
  return self->priv->data.m_ustring;
332
}
62 by Gustav Hartvigsson
* General documentation clean up.
333
61 by Gustav Hartvigsson
* Made the code more easy to read.
334
void
335
s_method_box_free (SBox * self) {
49 by Gustav Hartvigsson
* started work SBox (Untested).
336
  SBoxClass * klass = S_BOX_CLASS (s_object_get_class(S_OBJECT(self)));
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
337
49 by Gustav Hartvigsson
* started work SBox (Untested).
338
  SBoxPrivate * priv = self->priv;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
339
62 by Gustav Hartvigsson
* General documentation clean up.
340
  FreeFunc free_func = priv->free_func;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
341
49 by Gustav Hartvigsson
* started work SBox (Untested).
342
  if (priv->free_data) {
343
    switch (priv->object_type) {
344
      case S_TYPE_OBJECT:
62 by Gustav Hartvigsson
* General documentation clean up.
345
        s_object_free (priv->data.m_sobject);
49 by Gustav Hartvigsson
* started work SBox (Untested).
346
        break;
347
      case S_TYPE_POINTER:
348
        if (free_func) {
62 by Gustav Hartvigsson
* General documentation clean up.
349
          free_func (priv->data.m_ptr);
49 by Gustav Hartvigsson
* started work SBox (Untested).
350
        } else {
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
351
          s_free (priv->data.m_ptr);
49 by Gustav Hartvigsson
* started work SBox (Untested).
352
        }
353
        break;
354
      case S_TYPE_STRING:
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
355
        s_free (priv->data.m_string);
49 by Gustav Hartvigsson
* started work SBox (Untested).
356
        break;
151.1.2 by Gustav Hartvigsson
* Removed wchar.
357
      #if 0
49 by Gustav Hartvigsson
* started work SBox (Untested).
358
      case S_TYPE_WSTRING:
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
359
        s_free (priv->data.m_wstring);
49 by Gustav Hartvigsson
* started work SBox (Untested).
360
        break;
151.1.2 by Gustav Hartvigsson
* Removed wchar.
361
      #endif
49 by Gustav Hartvigsson
* started work SBox (Untested).
362
      default:
363
        s_warn_print ("[SBox] free_data was set despite not being an object"
364
                      "that can be freed.");
365
    }
366
  }
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
367
121.1.3 by Gustav Hartvigsson
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
368
  s_free (self->priv);
369
  s_free (klass);
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
370
49 by Gustav Hartvigsson
* started work SBox (Untested).
371
}
372
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
373
char *
374
s_method_box_to_string (SBox * self) {
375
  char * ret_val = NULL;
103 by Gustav Hartvigsson
* General cleanup/make it pritty.
376
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
377
  switch (self->priv->object_type) {
378
    case (S_TYPE_INT):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
379
      ret_val = s_string_new_fmt ("(SBox, Char: %i)",
380
                                  self->priv->data.m_int);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
381
      break;
382
    case (S_TYPE_CHAR):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
383
      ret_val = s_string_new_fmt ("(SBox, Char: %c)",
384
                                  self->priv->data.m_char);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
385
      break;
386
    case (S_TYPE_LONG):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
387
      ret_val = s_string_new_fmt ("(SBox, Long: %li)",
388
                                  self->priv->data.m_long);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
389
      break;
390
    case (S_TYPE_OBJECT):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
391
      ret_val = s_string_new_fmt ("(SBox, SObject: %s)",
392
                                  s_object_to_string(
393
                                                   self->priv->data.m_sobject));
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
394
      break;
395
    case (S_TYPE_POINTER):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
396
      ret_val = s_string_new_fmt ("(SBox, Pointer: %lli)",
397
                                  self->priv->data.m_ptr);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
398
      break;
399
    case (S_TYPE_SHORT):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
400
      ret_val = s_string_new_fmt ("(SBox, Short: %hi)",
401
                                  self->priv->data.m_short);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
402
      break;
403
    case (S_TYPE_STRING):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
404
      ret_val = s_string_new_fmt ("(SBox, String: \"%s\")",
405
                                  self->priv->data.m_string);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
406
      break;
407
    case (S_TYPE_UINT):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
408
      ret_val = s_string_new_fmt ("(SBox, Unsigned Int: %u)",
409
                                  self->priv->data.m_uint);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
410
      break;
411
    case (S_TYPE_ULONG):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
412
      ret_val = s_string_new_fmt ("(SBox, Unsigned Long: %lu)",
413
                                  self->priv->data.m_ulong);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
414
      break;
415
    case (S_TYPE_USHORT):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
416
      ret_val = s_string_new_fmt ("(SBox, Unsigned Short: %hu)",
417
                                  self->priv->data.m_ushort);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
418
      break;
151.1.2 by Gustav Hartvigsson
* Removed wchar.
419
    #if 0
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
420
    case (S_TYPE_WCHAR):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
421
      ret_val = s_string_new_fmt ("(SBox, Wide Char: %lc)",
422
                                  self->priv->data.m_wchar);
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
423
      break;
151.1.2 by Gustav Hartvigsson
* Removed wchar.
424
    
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
425
    case (S_TYPE_WSTRING):
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
426
      ret_val = s_string_new_fmt ("(SBox, Wide String: %s)",
427
                                  s_wstring_to_string (
428
                                                   self->priv->data.m_wstring));
429
      break;
151.1.2 by Gustav Hartvigsson
* Removed wchar.
430
    #endif
72 by Gustav Hartvigsson
* Added our own types for stability and shit and giggles.
431
    case (S_TYPE_USTRING):
432
      ret_val = s_string_new_fmt ("(SBox, U String: %s)",
433
                                  s_ustring_to_string (
434
                                                   self->priv->data.m_ustring));
435
      break;
63 by Gustav Hartvigsson
* Working on SMatrix to finish it off.
436
    default:
437
      s_err_print ("THIS SHOULD NOT BE ALBE TO BE REACHED.");
438
  }
439
  return ret_val;
440
}
43 by Gustav Hartvigsson
* Code cleanup
441