1
2 /* This file is part of GMetaDOM
3 * a generic bind package for the Document Object Model API.
4 * Copyright (C) 2001-2002 Luca Padovani <luca.padovani@cs.unibo.it>
5 * 2002 Claudio Sacerdoti Coen <sacerdot@cs.unibo.it>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * For more information, please visit the project home page
22 * http://gmetadom.sourceforge.net
23 * or send an email to <luca.padovani@cs.unibo.it>
24 *
25 * DO NOT EDIT: this file has been generated automatically by GMetaDOM
26 */
27
28 #include <assert.h>
29 #include <gdome.h>
30
31 #include <caml/memory.h>
32 #include <caml/custom.h>
33 #include "mlgdomevalue.h"
34
35 static void
ml_gdome_cds_finalize(value v)36 ml_gdome_cds_finalize(value v)
37 {
38 GdomeException exc_ = 0;
39 GdomeCDATASection* obj_ = CDATASection_val(v);
40 g_assert(obj_ != NULL);
41 gdome_cds_unref(obj_, &exc_);
42 assert(exc_ == 0);
43 }
44
45 static int
ml_gdome_cds_compare(value v1,value v2)46 ml_gdome_cds_compare(value v1, value v2)
47 {
48 CAMLparam2(v1,v2);
49 GdomeCDATASection* obj1_ = CDATASection_val(v1);
50 GdomeCDATASection* obj2_ = CDATASection_val(v2);
51 CAMLreturn((int) (obj1_ - obj2_));
52 }
53
54 GdomeCDATASection*
CDATASection_val(value v)55 CDATASection_val(value v)
56 {
57 GdomeCDATASection* res_ = *((GdomeCDATASection**) Data_custom_val(v));
58 g_assert(res_ != NULL);
59 return res_;
60 }
61
62 value
Val_CDATASection(GdomeCDATASection * obj)63 Val_CDATASection(GdomeCDATASection* obj)
64 {
65 static struct custom_operations ops = {
66 "http://gmetadom.sourceforge.net/gdome_caml/Core/CDATASection",
67 ml_gdome_cds_finalize,
68 ml_gdome_cds_compare,
69 custom_hash_default,
70 custom_serialize_default,
71 custom_deserialize_default
72 };
73
74 value v = alloc_custom(&ops, sizeof(GdomeCDATASection*), 0, 1);
75 g_assert(obj != NULL);
76 *((GdomeCDATASection**) Data_custom_val(v)) = obj;
77
78 return v;
79 }
80
81
82 value
ml_gdome_cds_of_n(value obj)83 ml_gdome_cds_of_n(value obj)
84 {
85 CAMLparam1(obj);
86 GdomeException exc_;
87 GdomeCDATASection* obj_;
88
89 obj_ = gdome_cast_cds((GdomeNode*) Node_val(obj));
90
91 if (obj_ == 0) throw_cast_exception("CDATASection");
92 gdome_cds_ref(obj_, &exc_);
93 if (exc_ != 0) throw_exception(exc_, "CDATASection casting from Node");
94 CAMLreturn(Val_CDATASection(obj_));
95 }
96
97