+(* wrappi -*- tuareg -*-
+ * Copyright (C) 2011-2012 Red Hat Inc.
+ *
+ * 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
+ *)
+
entry_point local
bool error ()
<<
- return w->error_flag;
+ return w->internal.error != NULL;
>>
entry_point local
void clear_error ()
<<
- w->error_flag = 0;
->>
\ No newline at end of file
+ free (w->internal.error);
+ w->internal.error = NULL;
+ w->internal.errnum = 0;
+ w->internal.error_func = NULL;
+>>
+
+entry_point local
+static_string get_error ()
+<<
+ if (!w->internal.error) {
+ set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
+ return NULL;
+ }
+ return w->internal.error;
+>>
+
+entry_point local
+int get_errno ()
+<<
+ if (!w->internal.error) {
+ set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
+ return -1;
+ }
+ return w->internal.errnum;
+>>
+
+entry_point local
+static_string get_error_func ()
+<<
+ if (!w->internal.error) {
+ set_error ("no error on handle: do not call this function unless 'wrap_error' returns true");
+ return NULL;
+ }
+ return w->internal.error_func;
+>>
+
+(*
+event error ???
+*)