diff options
author | Dr. Michael Lauer <mickey@vanille-media.de> | 2018-03-16 15:33:08 +0100 |
---|---|---|
committer | Dr. Michael Lauer <mickey@vanille-media.de> | 2018-03-16 15:33:08 +0100 |
commit | 9fd331654fbe1d274a5b0f670207067ecb73b02a (patch) | |
tree | 7dffc961b90da2d2473e4bac9c2a544d1f222d24 | |
parent | 20bc331aea49ec36b4e0f96cb012595519cc2900 (diff) | |
download | vala-wip/mickey/posix-profile.tar.gz |
posix: (POSIX profile) bind va_list and add string.concatwip/mickey/posix-profile
This fixes string templates when using the POSIX profile
-rw-r--r-- | vapi/posix.vapi | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vapi/posix.vapi b/vapi/posix.vapi index 0bfc879d8..0c1397bd8 100644 --- a/vapi/posix.vapi +++ b/vapi/posix.vapi @@ -131,6 +131,17 @@ public struct ssize_t { } } +[SimpleType] +[CCode (cheader_filename = "stdarg.h", cprefix = "va_", has_type_id = false, destroy_function = "va_end", lvalue_access = false)] +public struct va_list { + [CCode (cname = "va_start")] + public va_list (); + [CCode (cname = "va_copy")] + public va_list.copy (va_list src); + [CCode (generic_type_pos = 1.1, simple_generics = true)] + public unowned G arg<G> (); +} + [CCode (cname = "int8_t", cheader_filename = "stdint.h", default_value = "0")] [IntegerType (rank = 1, min = -128, max = 127)] public struct int8 { @@ -271,6 +282,21 @@ public class string { [PrintfFormat] public string printf (...); + public string concat (...) { + string result = this; + var l = va_list(); + while (true) { + string? arg = l.arg(); + if (arg == null) { + break; + } + else { + result = "%s%s".printf( result, arg ); + } + } + return result; + } + public inline unowned string to_string () { return this; } |