/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to src/utils/utils.vala

  • Committer: Gustav Hartvigsson
  • Date: 2022-06-01 12:14:52 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20220601121452-ntu94w67q3dhhfeq
More work torwards inperementing the parser.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * Created by Gustav Hartivgsson.
5
5
 */
6
 
 
 
6
[CCode (cname = "V", cprefix = "v_")]
7
7
namespace Utils {
 
8
  [CCode (cname = "v_str_cmp")]
8
9
  public int str_cmp (string a, string b) {
9
10
    return a.collate (b);
10
11
  }
11
12
  
 
13
  [CCode (cname = "v_print_ln")]
12
14
  public void print_ln (string str, ...) {
13
15
    var va = va_list ();
14
16
    var tmp = str + "\n";
15
17
    stdout.vprintf (tmp, va);
16
18
  }
17
19
 
 
20
  [CCode (cname = "v_err_print_ln")]
18
21
  public void err_print_ln (string str, ...) {
19
22
    var va = va_list ();
20
23
    var tmp = str + "\n";
21
24
    stderr.vprintf (tmp, va);
22
25
  }
23
 
  
 
26
 
 
27
  [CCode (cname = "v_object_to_string")]
24
28
  public string object_to_string (GLib.Object obj) {
25
29
     StringBuilder strbldr = new StringBuilder ();
26
30
     internal_object_to_string (obj, ref strbldr);
41
45
    return strbldr.str;
42
46
  }
43
47
 
44
 
  private unowned StringBuilder internal_object_to_string (GLib.Object obj,
 
48
  [CCode (cname = "v_internal_object_to_string")]
 
49
  internal unowned StringBuilder internal_object_to_string (GLib.Object obj,
45
50
                                                  ref StringBuilder str_builder,
46
51
                                                  int nesting = 0) {
47
52
    GLib.ObjectClass obj_class = (GLib.ObjectClass) obj.get_type ().class_ref ();