From 4f769985ea4174a5eed16e6dc2343094ad744aed Mon Sep 17 00:00:00 2001 From: Fabian Deutsch Date: Sat, 19 Jun 2010 22:04:38 +0200 Subject: [PATCH 1/2] Add bindings for augeas. Signed-off-by: Fabian Deutsch --- vapi/augeas.vapi | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 95 insertions(+), 0 deletions(-) create mode 100644 vapi/augeas.vapi diff --git a/vapi/augeas.vapi b/vapi/augeas.vapi new file mode 100644 index 0000000..e73aeec --- /dev/null +++ b/vapi/augeas.vapi @@ -0,0 +1,95 @@ +/* augeas.vapi + * + * Copyright (C) 2010 Fabian Deutsch + * + * 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.1 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: + * Fabian Deutsch + */ + +[CCode (cheader_filename = "augeas.h")] +namespace Augeas { + + [Flags] + [CCode (cprefix = "AUG_")] + public enum InitFlags { + NONE, + SAVE_BACKUP, + SAVE_NEWFILE, + TYPE_CHECK, + NO_STDINC, + SAVE_NOOP, + NO_LOAD, + NO_MODL_AUTOLOAD + } + + [CCode (cprefix= "AUG_")] + public enum ErrorCode + { + NOERROR, + ENOMEM, + EINTERNAL, + EPATHX, + ENOMATCH, + EMMATCH, + ESYNTAX, + ENOLENS, + EMXFM + } + + [Compact] + [CCode (cname = "augeas", cprefix = "aug_", free_function = "aug_close")] + public class Augeas { + + [CCode (cname = "aug_init")] + public Augeas (string? root = null, string? loadpath = null, uint flags = 0); + + public int defvar (string name, string? expr); + public int defnode (string name, string expr, string value, out int created); + + public int get (string path, out unowned string? value); + public int set (string path, string value); + public int insert (string path, string label, int before); + + public int rm (string path); + public int mv (string src, string dst); + + [CCode (cname = "aug_match_wrapper")] + public int match (string path, out string[]? matches = null) + { + int len = _match (path, out matches); + if( matches != null ) matches.length = len; + return len; + } + [CCode (cname = "aug_match")] + int _match(string p, [CCode (array_length = false)] out string[]? matches); + + public int save (); + public int load (); +#if POSIX + public int print (Posix.FILE out, string path); +#else + public int print (GLib.FileStream out, string path); +#endif + public void close (); + + public ErrorCode error (); + public string error_message (); + public string error_minor_message (); + public string error_details (); + } +} + -- 1.7.1