--- /dev/null
+ENCODING=.
+AFM=/usr/share/texmf/fonts/afm/
+TYPE1=/usr/share/texmf/fonts/type1/bluesky/cm/:/usr/X11R6/lib/X11/fonts/Type1/:.
--- /dev/null
+(W) T1_AAInit(): Unsupported AA specification: level=2, bpp=0
+(W) T1_AAInit(): Unsupported AA specification: level=2, bpp=0
+(W) T1_AAInit(): Unsupported AA specification: level=2, bpp=0
--- /dev/null
+
+all: ml_minidom.o minidom.cmi minidom.cmo minidom.cmx test test.opt
+
+ml_minidom.o: ml_minidom.c
+ gcc -c -I../ -I/usr/lib/ocaml/caml/ `glib-config --cflags` `xml-config --cflags` `gtkmathview-config --cflags` $<
+
+minidom.cmi: minidom.mli
+ ocamlc -c $<
+
+minidom.cmo: minidom.ml
+ ocamlc -c $<
+
+minidom.cmx: minidom.ml
+ ocamlopt -c $<
+
+test.cmo: test.ml
+ ocamlc -c test.ml
+
+test.cmx: test.ml
+ ocamlopt -c test.ml
+
+test: test.cmo minidom.cmi ml_minidom.o
+ ocamlc -custom -o test minidom.cmo test.cmo ml_minidom.o \
+ -cclib "`xml-config --libs`" -cclib "`glib-config --libs`" \
+ -cclib "`gtkmathview-config --libs`"
+
+test.opt: test.cmx minidom.cmi ml_minidom.o
+ ocamlopt -o test.opt minidom.cmx test.cmx ml_minidom.o \
+ -cclib "`xml-config --libs`" -cclib "`glib-config --libs`" \
+ -cclib "`gtkmathview-config --libs`"
+
+clean:
+ rm -f *.o *.cm? test
+
+cleanbak:
+ rm -f *~
--- /dev/null
+
+type mDOMString
+type mDOMDoc
+type mDOMNode
+type mDOMAttr
+type mDOMEntity
+
+external string_of_mDOMString : mDOMString -> string = "ml_string_of_mDOMString"
+external mDOMString_of_string : string -> mDOMString = "ml_mDOMString_of_string"
+external mDOMString_eq : string -> string -> bool = "ml_mDOMString_eq"
+
+external doc_load : string -> mDOMDoc = "ml_doc_load"
+external doc_unload : mDOMDoc -> unit = "ml_doc_unload"
+
+external doc_new : mDOMString -> mDOMDoc = "ml_doc_new"
+external doc_get_root_node : mDOMDoc -> mDOMNode = "ml_doc_get_root_node"
+
+external doc_add_entity : mDOMDoc -> mDOMString -> mDOMString -> mDOMEntity = "ml_doc_add_entity"
+external doc_get_entity : mDOMDoc -> mDOMString -> mDOMEntity option = "ml_doc_get_entity"
+external doc_get_predefined_entity : mDOMDoc -> mDOMString -> mDOMEntity option = "ml_doc_get_predefined_entity"
+external entity_get_content : mDOMEntity -> mDOMString = "ml_entity_get_content"
+
+external node_is_text : mDOMNode -> bool = "ml_node_is_text"
+external node_is_element : mDOMNode -> bool = "ml_node_is_element"
+external node_is_blank : mDOMNode -> bool = "ml_node_is_blank"
+external node_is_entity_ref : mDOMNode -> bool = "ml_node_is_entity_ref"
+external node_get_type : mDOMNode -> int = "ml_node_get_type"
+external node_get_name : mDOMNode -> mDOMString option = "ml_node_get_name"
+external node_get_ns_uri : mDOMNode -> mDOMString option = "ml_node_get_ns_uri"
+external node_get_attribute : mDOMNode -> mDOMString -> mDOMString option = "ml_node_get_attribute"
+external node_get_attribute_ns : mDOMNode -> mDOMString -> mDOMString -> mDOMString option = "ml_node_get_attribute_ns"
+external node_get_content : mDOMNode -> mDOMString option = "ml_node_get_content"
+external node_get_parent : mDOMNode -> mDOMNode option = "ml_node_get_parent"
+external node_get_prev_sibling : mDOMNode -> mDOMNode option = "ml_node_get_prev_sibling"
+external node_get_next_sibling : mDOMNode -> mDOMNode option = "ml_node_get_next_sibling"
+external node_get_first_child : mDOMNode -> mDOMNode option = "ml_node_get_first_child"
+external node_get_first_attribute : mDOMNode -> mDOMAttr option = "ml_node_get_first_attribute"
+external node_is_first : mDOMNode -> bool = "ml_node_is_first"
+external node_is_last : mDOMNode -> bool = "ml_node_is_last"
+
+external attr_get_name : mDOMAttr -> mDOMString option = "ml_attr_get_name"
+external attr_get_ns_uri : mDOMAttr -> mDOMString option = "ml_attr_get_ns_uri"
+external attr_get_value : mDOMAttr -> mDOMString option = "ml_attr_get_value"
+external attr_get_prev_sibling : mDOMAttr -> mDOMAttr option = "ml_attr_get_prev_sibling"
+external attr_get_next_sibling : mDOMAttr -> mDOMAttr option = "ml_attr_get_next_sibling"
+external attr_get_parent : mDOMAttr -> mDOMNode option = "ml_attr_get_parent"
+
+let rec node_list_of_node_first =
+ function None -> []
+ | Some node -> node :: (node_list_of_node_first (node_get_next_sibling node))
+
+let rec attr_list_of_attr_first =
+ function None -> []
+ | Some attr -> attr :: (attr_list_of_attr_first (attr_get_next_sibling attr))
+
+let node_get_children node =
+ (node_list_of_node_first (node_get_first_child node))
+
+let node_get_attributes node =
+ (attr_list_of_attr_first (node_get_first_attribute node))
+
--- /dev/null
+
+type mDOMString
+type mDOMDoc
+type mDOMNode
+type mDOMAttr
+type mDOMEntity
+
+external string_of_mDOMString : mDOMString -> string = "ml_string_of_mDOMString"
+external mDOMString_of_string : string -> mDOMString = "ml_mDOMString_of_string"
+external mDOMString_eq : string -> string -> bool = "ml_mDOMString_eq"
+
+external doc_load : string -> mDOMDoc = "ml_doc_load"
+external doc_unload : mDOMDoc -> unit = "ml_doc_unload"
+
+external doc_new : mDOMString -> mDOMDoc = "ml_doc_new"
+external doc_get_root_node : mDOMDoc -> mDOMNode = "ml_doc_get_root_node"
+
+external doc_add_entity : mDOMDoc -> mDOMString -> mDOMString -> mDOMEntity = "ml_doc_add_entity"
+external doc_get_entity : mDOMDoc -> mDOMString -> mDOMEntity option = "ml_doc_get_entity"
+external doc_get_predefined_entity : mDOMDoc -> mDOMString -> mDOMEntity option = "ml_doc_get_predefined_entity"
+external entity_get_content : mDOMEntity -> mDOMString = "ml_entity_get_content"
+
+external node_is_text : mDOMNode -> bool = "ml_node_is_text"
+external node_is_element : mDOMNode -> bool = "ml_node_is_element"
+external node_is_blank : mDOMNode -> bool = "ml_node_is_blank"
+external node_is_entity_ref : mDOMNode -> bool = "ml_node_is_entity_ref"
+external node_get_type : mDOMNode -> int = "ml_node_get_type"
+external node_get_name : mDOMNode -> mDOMString option = "ml_node_get_name"
+external node_get_ns_uri : mDOMNode -> mDOMString option = "ml_node_get_ns_uri"
+external node_get_attribute : mDOMNode -> mDOMString -> mDOMString option = "ml_node_get_attribute"
+external node_get_attribute_ns : mDOMNode -> mDOMString -> mDOMString -> mDOMString option = "ml_node_get_attribute_ns"
+external node_get_content : mDOMNode -> mDOMString option = "ml_node_get_content"
+external node_get_parent : mDOMNode -> mDOMNode option = "ml_node_get_parent"
+external node_get_prev_sibling : mDOMNode -> mDOMNode option = "ml_node_get_prev_sibling"
+external node_get_next_sibling : mDOMNode -> mDOMNode option = "ml_node_get_next_sibling"
+external node_get_first_child : mDOMNode -> mDOMNode option = "ml_node_get_first_child"
+external node_get_first_attribute : mDOMNode -> mDOMAttr option = "ml_node_get_first_attribute"
+external node_is_first : mDOMNode -> bool = "ml_node_is_first"
+external node_is_last : mDOMNode -> bool = "ml_node_is_last"
+
+external attr_get_name : mDOMAttr -> mDOMString option = "ml_attr_get_name"
+external attr_get_ns_uri : mDOMAttr -> mDOMString option = "ml_attr_get_ns_uri"
+external attr_get_value : mDOMAttr -> mDOMString option = "ml_attr_get_value"
+external attr_get_prev_sibling : mDOMAttr -> mDOMAttr option = "ml_attr_get_prev_sibling"
+external attr_get_next_sibling : mDOMAttr -> mDOMAttr option = "ml_attr_get_next_sibling"
+external attr_get_parent : mDOMAttr -> mDOMNode option = "ml_attr_get_parent"
+
+val node_get_children : mDOMNode -> mDOMNode list
+val node_get_attributes : mDOMNode -> mDOMAttr list
+
--- /dev/null
+
+#include <assert.h>
+#include <mlvalues.h>
+#include <memory.h>
+
+#include "minidom.h"
+#include "ml_minidom.h"
+
+static value
+ml_some(value v)
+{
+ CAMLparam1(v);
+ value ret = alloc_small(1,0);
+ Field(ret,0) = v;
+ CAMLreturn(ret);
+}
+
+value
+ml_string_of_mDOMString(value s)
+{
+ CAMLparam1(s);
+ CAMLreturn(s);
+}
+
+value
+ml_mDOMString_of_string(value s)
+{
+ CAMLparam1(s);
+ CAMLreturn(s);
+}
+
+value
+ml_doc_load(value file_name)
+{
+ mDOMDocRef doc_ref;
+
+ CAMLparam1(file_name);
+
+ doc_ref = mdom_load(String_val(file_name), FALSE, NULL);
+ if (doc_ref == NULL) failwith("minidom: could not load document");
+
+ CAMLreturn((value) doc_ref);
+}
+
+value
+ml_doc_unload(value doc)
+{
+ CAMLparam1(doc);
+
+ mdom_unload((mDOMDocRef) doc);
+
+ CAMLreturn(Val_unit);
+}
+
+value
+ml_doc_new(value s)
+{
+ mDOMDocRef doc_ref;
+
+ CAMLparam1(s);
+
+ doc_ref = mdom_doc_new(mDOMString_val(s));
+ if (doc_ref == NULL) failwith("minidom: could not create new document");
+
+ CAMLreturn((value) doc_ref);
+}
+
+
+value
+ml_doc_get_root_node(value doc)
+{
+ mDOMNodeRef root;
+
+ CAMLparam1(doc);
+ root = mdom_doc_get_root_node((mDOMDocRef) doc);
+ if (root == NULL) failwith("minidom: document has no root node!");
+
+ CAMLreturn((value) root);
+}
+
+value
+ml_doc_add_entity(value doc, value name, value content)
+{
+ mDOMEntityRef ent;
+
+ CAMLparam3(doc, name, content);
+ ent = mdom_doc_add_entity((mDOMDocRef) doc, mDOMString_val(name), mDOMString_val(content));
+ if (ent == NULL) failwith("minidom: could not add entity");
+
+ CAMLreturn((value) ent);
+}
+
+value
+ml_doc_get_entity(value doc, value name)
+{
+ mDOMEntityRef ent;
+
+ CAMLparam2(doc, name);
+ ent = mdom_doc_get_entity((mDOMDocRef) doc, mDOMString_val(name));
+
+ CAMLreturn(Val_option(ent, Val_ptr));
+}
+
+value
+ml_doc_get_predefined_entity(value name)
+{
+ mDOMEntityRef ent;
+
+ CAMLparam1(name);
+ ent = mdom_get_predefined_entity(mDOMString_val(name));
+
+ CAMLreturn(Val_option(ent, Val_ptr));
+}
+
+value
+ml_entity_get_content(value ent)
+{
+ CAMLparam1(ent);
+ CAMLreturn(Val_mDOMString(mdom_entity_get_content((mDOMEntityRef) ent)));
+}
+
+value
+ml_node_is_text(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_bool(mdom_node_is_text((mDOMNodeRef) node)));
+}
+
+value
+ml_node_is_element(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_bool(mdom_node_is_element((mDOMNodeRef) node)));
+}
+
+value
+ml_node_is_blank(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_bool(mdom_node_is_blank((mDOMNodeRef) node)));
+}
+
+value
+ml_node_is_entity_ref(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_bool(mdom_node_is_entity_ref((mDOMNodeRef) node)));
+}
+
+value
+ml_node_get_type(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_int(mdom_node_get_type((mDOMNodeRef) node)));
+}
+
+value
+ml_node_get_name(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_option(mdom_node_get_name((mDOMNodeRef) node), Val_mDOMString));
+}
+
+value
+ml_node_get_ns_uri(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_option(mdom_node_get_ns_uri((mDOMNodeRef) node), Val_mDOMString));
+}
+
+value
+ml_node_get_attribute(value node, value name)
+{
+ CAMLparam2(node,name);
+ CAMLreturn(Val_option(mdom_node_get_attribute((mDOMNodeRef) node, String_val(name)), Val_mDOMString));
+}
+
+value
+ml_node_get_attribute_ns(value node, value name, value ns_uri)
+{
+ CAMLparam2(node,name);
+ CAMLreturn(Val_option(mdom_node_get_attribute_ns((mDOMNodeRef) node,
+ String_val(name),
+ String_val(ns_uri)), Val_mDOMString));
+}
+
+value
+ml_node_get_parent(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_option(mdom_node_get_parent((mDOMNodeRef) node), Val_ptr));
+}
+
+value
+ml_node_get_prev_sibling(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_option(mdom_node_get_prev_sibling((mDOMNodeRef) node), Val_ptr));
+}
+
+value
+ml_node_get_next_sibling(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_option(mdom_node_get_next_sibling((mDOMNodeRef) node), Val_ptr));
+}
+
+value
+ml_node_get_first_child(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_option(mdom_node_get_first_child((mDOMNodeRef) node), Val_ptr));
+}
+
+value
+ml_node_get_first_attribute(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_option(mdom_node_get_first_attribute((mDOMNodeRef) node), Val_ptr));
+}
+
+value
+ml_node_is_first(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_bool(mdom_node_is_first((mDOMNodeRef) node)));
+}
+
+value
+ml_node_is_last(value node)
+{
+ CAMLparam1(node);
+ CAMLreturn(Val_bool(mdom_node_is_last((mDOMNodeRef) node)));
+}
+
+value
+ml_attr_get_name(value attr)
+{
+ CAMLparam1(attr);
+ CAMLreturn(Val_option(mdom_attr_get_name((mDOMAttrRef) attr), Val_mDOMString));
+}
+
+value
+ml_attr_get_ns_uri(value attr)
+{
+ CAMLparam1(attr);
+ CAMLreturn(Val_option(mdom_attr_get_ns_uri((mDOMAttrRef) attr), Val_mDOMString));
+}
+
+value
+ml_attr_get_value(value attr)
+{
+ CAMLparam1(attr);
+ CAMLreturn(Val_option(mdom_attr_get_value((mDOMAttrRef) attr), Val_mDOMString));
+}
+
+value
+ml_attr_get_prev_sibling(value attr)
+{
+ CAMLparam1(attr);
+ CAMLreturn(Val_option(mdom_attr_get_prev_sibling((mDOMAttrRef) attr), Val_ptr));
+}
+
+value
+ml_attr_get_next_sibling(value attr)
+{
+ CAMLparam1(attr);
+ CAMLreturn(Val_option(mdom_attr_get_next_sibling((mDOMAttrRef) attr), Val_ptr));
+}
+
+value
+ml_attr_get_parent(value attr)
+{
+ CAMLparam1(attr);
+ CAMLreturn(Val_option(mdom_attr_get_parent((mDOMAttrRef) attr), Val_ptr));
+}
+
--- /dev/null
+#define Val_ptr(p) ((value) (p))
+#define Val_option(p,f) ((p != NULL) ? ml_some(f(p)) : Val_unit)
+#define Val_mDOMString(s) (copy_string((char*) (s)))
+#define mDOMString_val(v) ((mDOMStringRef) String_val(v))
+#define mDOMNode_val(v) ((mDOMNodeRef) v)
--- /dev/null
+
+let doc = Minidom.doc_load "test.xml"
+
+let root = Minidom.doc_get_root_node doc
+
+let Some root_name = Minidom.node_get_name root
+;;
+
+print_string (Minidom.string_of_mDOMString root_name)
\ No newline at end of file
--- /dev/null
+<prova>
+ <ciao/>
+</prova>
--- /dev/null
+#include <string.h>
+#include <gtk/gtk.h>
+#include <caml/mlvalues.h>
+#include <caml/alloc.h>
+#include <caml/memory.h>
+#include <caml/callback.h>
+#include <caml/fail.h>
+
+#include <gtkmathview/gtkmathview.h>
+#include <ml_gtk.h>
+
+#include <wrappers.h>
+#include <ml_glib.h>
+#include <ml_gdk.h>
+#include <ml_gtk.h>
+#include <gtk_tags.h>
+
+#include "minidom/ml_minidom.h"
+
+/* <CSC/>: Next row should be put in a .h of lablgtk. */
+#define GtkAdjustment_val(val) check_cast(GTK_ADJUSTMENT,val)
+
+#define GtkMathView_val(val) check_cast(GTK_MATH_VIEW,val)
+ML_3 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_val, Bool_val, Val_GtkWidget_sink)
+ML_2 (gtk_math_view_load, GtkMathView_val, String_val, Val_bool)
+ML_1 (gtk_math_view_unload, GtkMathView_val, Unit)
+/*ML_1 (gtk_math_view_dump, GtkMathView_val, Unit)*/
+ML_1 (gtk_math_view_get_selection, GtkMathView_val, Val_ptr)
+ML_2 (gtk_math_view_set_selection, GtkMathView_val, mDOMNode_val, Unit)
+ML_1 (gtk_math_view_get_width, GtkMathView_val, Val_int)
+ML_1 (gtk_math_view_get_height, GtkMathView_val, Val_int)
+ML_3 (gtk_math_view_set_top, GtkMathView_val, Int_val, Int_val, Unit)
+ML_3 (gtk_math_view_set_adjustments, GtkMathView_val, GtkAdjustment_val, GtkAdjustment_val, Unit)
+ML_1 (gtk_math_view_get_hadjustment, GtkMathView_val, Val_GtkWidget)
+ML_1 (gtk_math_view_get_vadjustment, GtkMathView_val, Val_GtkWidget)
+ML_1 (gtk_math_view_get_buffer, GtkMathView_val, Val_GdkPixmap)
+ML_1 (gtk_math_view_get_frame, GtkMathView_val, Val_GtkWidget)
+ML_2 (gtk_math_view_set_font_size, GtkMathView_val, Int_val, Unit)
+ML_1 (gtk_math_view_get_font_size, GtkMathView_val, Val_int)
+ML_2 (gtk_math_view_set_anti_aliasing, GtkMathView_val, Bool_val, Unit)
+ML_1 (gtk_math_view_get_anti_aliasing, GtkMathView_val, Val_bool)
+ML_2 (gtk_math_view_set_kerning, GtkMathView_val, Bool_val, Unit)
+ML_1 (gtk_math_view_get_kerning, GtkMathView_val, Val_bool)
+ML_2 (gtk_math_view_set_log_verbosity, GtkMathView_val, Int_val, Unit)
+ML_1 (gtk_math_view_get_log_verbosity, GtkMathView_val, Val_int)
+
+
+value ml_gtk_math_view_export_to_postscript (value arg1, value arg2)
+{
+ CAMLparam1(arg1);
+ char *filename;
+ FILE *fd;
+ int res;
+ filename = String_val (arg2);
+ if ((fd = fopen(filename, "w"))) {
+ gtk_math_view_export_to_postscript (GtkMathView_val (arg1), fd);
+ fclose (fd);
+ res = 1;
+ } else {
+ fprintf(stderr, "Error opening file %s for writing\n", filename);
+ res = 0;
+ }
+ CAMLreturn (Val_bool(res));
+}
+
+value ml_gtk_math_view_get_top (value arg1)
+{
+ CAMLparam1(arg1);
+ CAMLlocal1 (result);
+ int x, y;
+ gtk_math_view_get_top(GtkMathView_val (arg1), &x, &y);
+ result = alloc(2, 0);
+ Store_field(result, 0, Val_int(x));
+ Store_field(result, 0, Val_int(y));
+ CAMLreturn (result);
+}
+
+
+value ml_gtk_math_view_mDOMNode_of_bodex_option (value arg1)
+{
+ CAMLparam1(arg1);
+
+ mDOMNodeRef nr;
+
+ if (arg1==Val_int(0)) {
+ nr = NULL;
+ } else {
+ nr = (mDOMNodeRef) Field(arg1, 0);
+ }
+
+ CAMLreturn((value) nr);
+}