Commit 611df119 authored by Raffaele Sandrini's avatar Raffaele Sandrini Committed by Raffaele Sandrini

add basic zlib support add some string members, add some process exit

2007-07-21 Raffaele Sandrini <raffaele@sandrini.ch>

	* vapi/zlib.vala: add basic zlib support
	* vapi/glib-2.0.vala: add some string members, add some process
	  exit status and signal handling functions/macros, enhance FileStream
	  create GLib.DirUtils to be the same for dirs as GLib.FileUtils is for
	  files, enhance GLib.HashTable binding, add g_list_free function to
	  the collection of HashTable freeing functions
	* vapi/Makefile.am: update

svn path=/trunk/; revision=365
parent 6bdea814
2007-07-21 Raffaele Sandrini <raffaele@sandrini.ch>
* vapi/zlib.vala: add basic zlib support
* vapi/glib-2.0.vala: add some string members, add some process
exit status and signal handling functions/macros, enhance FileStream
create GLib.DirUtils to be the same for dirs as GLib.FileUtils is for
files, enhance GLib.HashTable binding, add g_list_free function to
the collection of HashTable freeing functions
* vapi/Makefile.am: update
2007-07-21 Raffaele Sandrini <raffaele@sandrini.ch>
* vala/scanner.l: allow '\0' escape sequences
......
......@@ -24,6 +24,7 @@ dist_vapi_DATA = \
vala-1.0.vala \
vte.deps \
vte.vala \
zlib.vala \
$(NULL)
dist_noinst_DATA = \
......
......@@ -505,12 +505,16 @@ public struct string {
public weak string chomp();
[CCode (cname = "g_strchug")]
public weak string chug();
[CCode (cname = "g_strstrip")]
public weak string strip ();
[CCode (cname = "g_str_hash")]
public uint hash ();
[CCode (cname = "atoi")]
public int to_int ();
[CCode (cname = "strtoul")]
public ulong to_ulong (out string endptr = null, int _base = 0);
[CCode (cname = "g_ascii_strtoll")]
public int64 to_int64 (out string endptr = null, int _base = 0);
[CCode (cname = "strlen")]
......@@ -1327,7 +1331,50 @@ namespace GLib {
public static bool spawn_command_line_async (string! command_line) throws SpawnError;
public static bool spawn_command_line_sync (string! command_line, out string standard_output = null, out string standard_error = null, out int exit_status = null) throws SpawnError;
public static void close_pid (Pid pid);
/* these macros are required to examine the exit status of a process */
[CCode (cname = "WIFEXITED")]
public static bool if_exited (int status);
[CCode (cname = "WEXITSTATUS")]
public static int exit_status (int status);
[CCode (cname = "WIFSIGNALED")]
public static bool if_signaled (int status);
[CCode (cname = "WTERMSIG")]
public static ProcessSignal term_sig (int status);
[CCode (cname = "WCOREDUMP")]
public static bool core_dump (int status);
[CCode (cname = "WIFSTOPPED")]
public static bool if_stopped (int status);
[CCode (cname = "WSTOPSIG")]
public static ProcessSignal stop_sig (int status);
[CCode (cname = "WIFCONTINUED")]
public static bool if_continued (int status);
}
public enum ProcessSignal {
HUP,
INT,
QUIT,
ILL,
TRAP,
ABRT,
BUS,
FPE,
KILL,
SEGV,
PIPE,
ALRM,
TERM,
USR1,
USR2,
CHLD,
CONT,
STOP,
TSTP,
TTIN,
TTOU
}
/* File Utilities */
......@@ -1386,6 +1433,11 @@ namespace GLib {
public void puts (string s);
[CCode (cname = "fclose")]
public void close ();
[InstanceLast ()]
[CCode (cname = "fgets")]
public weak string gets (string s, int size);
[CCode (cname = "feof")]
public bool eof ();
}
[CCode (cprefix = "g_file_", cheader_filename = "glib/gstdio.h")]
......@@ -1396,6 +1448,8 @@ namespace GLib {
public static int open_tmp (string tmpl, out string name_used) throws FileError;
public static string read_link (string filename) throws FileError;
[CCode (cname = "g_mkstemp")]
public static int mkstemp (string tmpl);
[CCode (cname = "g_rename")]
public static int rename (string oldfilename, string newfilename);
[CCode (cname = "g_unlink")]
......@@ -1409,11 +1463,16 @@ namespace GLib {
public struct Dir {
public static Dir open (string filename, uint _flags = 0) throws FileError;
public weak string read_name ();
public void rewind ();
}
public struct DirUtils {
[CCode (cname = "g_mkdir")]
public static int create (string pathname, int mode);
[CCode (cname = "g_mkdir_with_parents")]
public static int create_with_parents (string pathname, int mode);
[CCode (cname = "mkdtemp")]
public static weak string mkdtemp (string template);
}
[ReferenceType (free_function = "g_mapped_file_free")]
......@@ -1846,6 +1905,10 @@ namespace GLib {
public void replace (K# key, V# value);
public weak V lookup (K key);
public bool remove (K key);
public ref List<weak K> get_keys ();
public ref List<weak V> get_values ();
[CCode (cname = "g_hash_table_foreach")]
public void for_each (HFunc func, pointer user_data);
}
public static delegate uint HashFunc (pointer key);
......@@ -1866,6 +1929,8 @@ namespace GLib {
public static GLib.DestroyNotify g_free;
[CCode (cname = "g_object_unref")]
public static GLib.DestroyNotify g_object_unref;
[CCode (cname = "g_list_free")]
public static GLib.DestroyNotify g_list_free;
/* Strings */
......
/* glib-2.0.vala
*
* Copyright (C) 2006-2007 Raffaele Sandrini
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Author:
* Raffaele Sandrini <raffaele@sandrini.ch>
*/
using GLib;
[CCode (lower_case_cprefix = "", cheader_filename = "zlib.h")]
namespace ZLib {
[CCode (cprefix = "gz")]
//[ReferenceType (free_function = "gzclose")]
[CCode (cname = "gzFile")]
public struct GZFileStream {
public static GZFileStream open (string path, string mode);
public static GZFileStream dopen (int fd, string mode);
public int setparams (int level, int strategy);
public int read (string buf, uint len);
public int write (string buf, uint len);
[PrintfFormat ()]
public int printf (string format, ...);
public int puts (string s);
public weak string gets (string buf, uint len);
public int flush (int flush);
public int rewind ();
public bool eof ();
public bool direct ();
public int close ();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment