]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
posix: Add FILE bindings
authorpancake <pancake@youterm.com>
Mon, 12 Oct 2009 21:07:15 +0000 (23:07 +0200)
committerJürg Billeter <j@bitron.ch>
Mon, 12 Oct 2009 21:08:07 +0000 (23:08 +0200)
vapi/posix.vapi

index b285f5ac3d02948db0364fd39aa498e67deba4e9..33c9acabe722be3399103558d3c6c6fddb098678 100644 (file)
@@ -138,6 +138,11 @@ public struct time_t {
 [CCode (cname = "char", const_cname = "const char", copy_function = "strdup", free_function = "free", cheader_filename = "stdlib.h,string.h")]
 public class string {
 }
+
+[CCode (cname="printf", cheader_filename = "stdio.h")]
+[PrintfFormat]
+public void print (string format,...);
+
 #endif
 
 [CCode (cprefix = "", lower_case_cprefix = "")]
@@ -1925,5 +1930,32 @@ namespace Posix {
        public const int MS_INVALIDATE;
        [CCode (cheader_filename = "sys/mman.h")]
        public const int MS_SYNC;
+
+       [SimpleType]
+       [CCode (cname = "FILE", free_function = "fclose", cheader_filename = "stdio.h")]
+       public struct FILE {
+               [CCode (cname="fprintf")]
+               public void printf (string format,...);
+               [CCode (cname="fscanf")]
+               public void scanf (string outstr,...);
+               [CCode (cname="fgets", instance_position="3")]
+               public void gets (string outstr, int len); //=strlen(outstr));
+               [CCode (cname="fputs", instance_position="2")]
+               public void puts (string str);
+               [CCode (cname="fputc", instance_position="2")]
+               public void putc (string str);
+               [CCode (cname="fopen")]
+               public static FILE open (string file, string mode);
+               [CCode (cname="fclose")]
+               public int close ();
+               [CCode (cname="fwrite", instance_position="4")]
+               public int write (void *ptr, int size, int nmemb);
+               [CCode (cname="fread", instance_position="4")]
+               public int read (void *ptr, int size, int nmemb);
+       }
+
+       public static FILE stderr;
+       public static FILE stdout;
+       public static FILE stdin;
 }