From: no author Date: Thu, 12 Apr 2001 11:19:15 +0000 (+0000) Subject: This commit was manufactured by cvs2svn to create branch 'start'. X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=d70d5de1ec9ccc86c9df45036245af34c37575ea;p=helm.git This commit was manufactured by cvs2svn to create branch 'start'. --- diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/.cvsignore b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/.cvsignore new file mode 100644 index 000000000..cd9e25037 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/.cvsignore @@ -0,0 +1 @@ +*.cmi *.cmo *.cmx *.cma *.cmxa config.make diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/.depend b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/.depend new file mode 100644 index 000000000..600449bb8 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/.depend @@ -0,0 +1,4 @@ +gMathView.cmo: gtkMathView.cmo gtk_mathview.cmo +gMathView.cmx: gtkMathView.cmx gtk_mathview.cmx +gtkMathView.cmo: gtk_mathview.cmo +gtkMathView.cmx: gtk_mathview.cmx diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/COPYING b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/COPYING new file mode 100644 index 000000000..20b480a10 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/COPYING @@ -0,0 +1,11 @@ +This library is made available under the LGPL. +You should have got a copy of the LGPL with Objective Caml. +The LGPL applies to all the files in this directory, but not in +subdirectories. + +For the test subdirectory, there is no specific licensing policy, +but you may freely take inspiration from the code, and copy parts of +it in your application. + +Author: + Claudio Sacerdoti Coen diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/Makefile b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/Makefile new file mode 100644 index 000000000..b8adbb47b --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/Makefile @@ -0,0 +1,109 @@ +# Makefile for lablgtk_mathview. + +LABLGTKDIR = /usr/lib/ocaml/lablgtk +MINIDOMDIR = ./minidom +TESTDIR = ./test +MLFLAGS += -I $(LABLGTKDIR) -I $(MINIDOMDIR) + +TARGETS = ml_gtk_mathview.o lablgtkmathview.cma + +all: Minidom $(TARGETS) + +opt: Minidom.opt lablgtkmathviewopt + +Minidom: + cd $(MINIDOMDIR); make + +Minidom.opt: + cd $(MINIDOMDIR); make opt + +configure: + @rm -f config.make + @$(MAKE) --no-print-directory -f configure.mk + +depend: + @rm -f .depend + @$(MAKE) --no-print-directory -f configure.mk .depend + +.depend config.make: + @$(MAKE) --no-print-directory -f configure.mk + +COMPILER = $(CAMLC) $(MLFLAGS) -w s -labels -c +LINKER = $(CAMLC) $(MLFLAGS) +COMPOPT = $(CAMLOPT) $(MLFLAGS) -w s -labels -c +LINKOPT = $(CAMLOPT) $(MLFLAGS) + +include config.make + +INSTALLDIR = $(LIBDIR)/lablgtk/mathview + +MLLIBS = lablgtkmathview.cma +CLIBS = +MLLINK = unix.cma str.cma + +ifdef DEBUG +CFLAGS = -g $(GTKCFLAGS) +MLLINK += -cclib -lcamlrund +MLFLAGS += -g +else +CFLAGS = -O -DGTK_NO_CHECK_CASTS -DGTK_DISABLE_COMPAT_H $(GTKCFLAGS) +endif +CFLAGS += $(MINIDOMCFLAGS) $(GTKMATHVIEWCFLAGS) + +THFLAGS = -thread +THLINK = unix.cma threads.cma + +ifdef USE_CC +CCOMPILER = $(CC) -c -I$(LIBDIR) $(CFLAGS) +else +CCOMPILER = ocamlc -c -ccopt "$(CFLAGS)" +endif + +# Rules +.SUFFIXES: .ml .mli .cmo .cmi .cmx .c .o .var .h .opt .def +.c.o: + $(CCOMPILER) $< +.ml.cmo: + $(COMPILER) $< +.mli.cmi: + $(COMPILER) $< +.ml.cmx: + $(COMPOPT) $< +.var.h: + ./var2def < $< > $@ +.var.c: + ./var2conv < $< > $@ + +# Targets +COBJS = ml_gtk_mathview.o +MLOBJS = gtk_mathview.cmo gtkMathView.cmo gMathView.cmo +ALLOBJS = $(MLOBJS) + +lablgtkmathviewopt: $(CLIBS) $(MLLIBS:.cma=.cmxa) + +install: + if test -d $(INSTALLDIR); then : ; else mkdir -p $(INSTALLDIR); fi + cp $(ALLOBJS:.cmo=.cmi) $(INSTALLDIR) + if test -f *.mli ; then cp *.mli $(INSTALLDIR) ; fi + cp $(ALLOBJS:.cmo=.ml) $(INSTALLDIR) + cp $(MLLIBS) $(INSTALLDIR) + cp $(COBJS) $(INSTALLDIR) + if test ! -z "$(CLIBS)" ; then cp $(CLIBS) $(INSTALLDIR) ; fi + if test -f lablgtkmathview.cmxa; then \ + cp $(MLLIBS:.cma=.cmxa) $(MLLIBS:.cma=.a) \ + $(INSTALLDIR); fi + +lablgtkmathview.cma: $(MLOBJS) + $(LINKER) -a -custom -o $@ $(MLOBJS) $(GTKLIBS) -cclib "$(GTKMATHVIEWLIBS)" -cclib "$(MINIDOMLIBS)" +lablgtkmathview.cmxa: $(MLOBJS:.cmo=.cmx) + $(LINKOPT) -a -o $@ $(MLOBJS:.cmo=.cmx) $(GTKLIBS) -cclib "$(GTKMATHVIEWLIBS)" -cclib "$(MINIDOMLIBS)" + +ml_gtk.o: $(LABLGTKDIR)/gtk_tags.c $(LABLGTKDIR)/gtk_tags.h \ + $(LABLGTKDIR)/ml_gtk.h $(LABLGTKDIR)/ml_gdk.h $(LABLGTKDIR)/wrappers.h + +clean: + rm -f *.cm* *.o *.a *_tags.[ch] $(TARGETS) + cd $(MINIDOMDIR); make clean + cd $(TESTDIR); make clean + +include .depend diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/configure.mk b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/configure.mk new file mode 100644 index 000000000..860e1b46b --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/configure.mk @@ -0,0 +1,65 @@ +# makefile for configuring lablGTK_mathview + +# Default compilers +CAMLC = ocamlc +CAMLOPT = ocamlopt + +# Default installation directories +BINDIR = `$(GETBINDIR)` +INSTALLDIR = $(LIBDIR)/lablgtk/mathview + +# Autoconf +GETLIBDIR = ocamlc -v | grep "^Standard" | sed 's/^.*: *//' +LIBDIR = `$(GETLIBDIR)` +GETBINDIR = $(GETLIBDIR) | sed -e 's|/lib/[^/]*$$|/bin|' -e 's|/lib$$|/bin|' +GETRANLIB = which ranlib 2>/dev/null | sed -e 's|.*/ranlib$$|!|' -e 's/^[^!]*$$/:/' -e 's/!/ranlib/' + +ifdef USE_GNOME +GTKGETCFLAGS = gtk-config --cflags`" -I"`gnome-config --includedir +GNOMELIBS = `gnome-config --libs gtkxmhtml` +else +GTKGETCFLAGS = gtk-config --cflags +endif + +GTKGETLIBS = gtk-config --libs + +configure: .depend config.make + +.depend: + ocamldep *.ml *.mli > .depend + +config.make: + @echo CAMLC=$(CAMLC) > config.make + @echo CAMLOPT=$(CAMLOPT) >> config.make + @echo USE_GL=$(USE_GL) >> config.make + @echo USE_GNOME=$(USE_GNOME) >> config.make + @echo USE_CC=$(USE_CC) >> config.make + @echo DEBUG=$(DEBUG) >> config.make + @echo CC=$(CC) >> config.make + @echo RANLIB=`$(GETRANLIB)` >> config.make + @echo LIBDIR=$(LIBDIR) >> config.make + @echo BINDIR=`$(GETBINDIR)` >> config.make + @echo INSTALLDIR=$(INSTALLDIR) >> config.make +# Luca: was +# @echo GTKCFLAGS=`$(GTKGETCFLAGS)` -I/usr/lib/ocaml/lablgtk >> config.make +# Luca: now + @echo GTKCFLAGS=`$(GTKGETCFLAGS)` -I$(LIBDIR)/lablgtk >> config.make + @echo GTKLIBS=`$(GTKGETLIBS)` | \ + sed -e 's/-l/-cclib &/g' -e 's/-[LRWr][^ ]*/-ccopt &/g' \ + >> config.make +<<<<<<< configure.mk +# Luca: GtkMathView configuration + @echo GTKMATHVIEWCFLAGS=`gtkmathview-config --cflags` >> config.make + @echo MINIDOMCFLAGS=`minidom-config --cflags` >> config.make + @echo GTKMATHVIEWLIBS=`gtkmathview-config --libs` >> config.make + @echo MINIDOMLIBS=`minidom-config --libs` >> config.make +# Luca: end of GtkMathView configuration +======= + # + echo GTKMATHVIEWLIBS="-ccopt \""`gtkmathview-config --libs`"\"" >> config.make + # +>>>>>>> 1.2 + @echo GNOMELIBS=$(GNOMELIBS) | \ + sed -e 's/-l/-cclib &/g' -e 's/-[LRWr][^ ]*/-ccopt &/g' \ + >> config.make + cat config.make diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gMathView.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gMathView.ml new file mode 100644 index 000000000..9108b866d --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gMathView.ml @@ -0,0 +1,68 @@ +open Gaux +open Gtk +open Gtk_mathview +open GtkBase +open GtkMathView +open GObj + +exception ErrorLoadingFile of string;; +exception ErrorWritingFile of string;; +exception NoSelection;; + +class math_view_signals obj = object + inherit GContainer.container_signals obj + method clicked = GtkSignal.connect ~sgn:MathView.Signals.clicked obj ~after + method jump = GtkSignal.connect ~sgn:MathView.Signals.jump obj ~after + method selection_changed = + GtkSignal.connect ~sgn:MathView.Signals.selection_changed obj ~after +end + +class math_view obj = object + inherit GContainer.container (obj : Gtk_mathview.math_view obj) + method connect = new math_view_signals obj + method load ~filename = + if not (MathView.load obj ~filename) then raise (ErrorLoadingFile filename) + method unload = MathView.unload obj + method has_selection = MathView.has_selection obj + method get_selection = MathView.get_selection obj + method set_selection node = MathView.set_selection obj node + method reset_selection = MathView.reset_selection obj + method get_width = MathView.get_width obj + method get_height = MathView.get_height obj + method get_top = MathView.get_top obj + method set_top = MathView.set_top obj + method set_adjustments = + fun adj1 adj2 -> + MathView.set_adjustments obj (GData.as_adjustment adj1) + (GData.as_adjustment adj2) + method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj) + method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj) + method get_buffer = MathView.get_buffer obj + method get_frame = new GBin.frame (MathView.get_frame obj) + method set_font_size = MathView.set_font_size obj + method get_font_size = MathView.get_font_size obj + method set_anti_aliasing = MathView.set_anti_aliasing obj + method get_anti_aliasing = MathView.get_anti_aliasing obj + method set_kerning = MathView.set_kerning obj + method get_kerning = MathView.get_kerning obj + method set_log_verbosity = MathView.set_log_verbosity obj + method get_log_verbosity = MathView.get_log_verbosity obj + method export_to_postscript ~width ~height ~x_margin ~y_margin ~disable_colors ~filename = + if not (MathView.export_to_postscript obj ~width ~height ~x_margin ~y_margin ~disable_colors ~filename) then + raise (ErrorWritingFile filename) + method get_font_manager_type = MathView.get_font_manager_type obj + method set_font_manager_type ~fm_type = MathView.set_font_manager_type obj ~fm_type +end + +let math_view ?adjustmenth ?adjustmentv ?border_width + ?width ?height ?packing ?show () += + let w = + MathView.create + ?adjustmenth:(may_map ~f:GData.as_adjustment adjustmenth) + ?adjustmentv:(may_map ~f:GData.as_adjustment adjustmentv) + () + in + Container.set w ?border_width ?width ?height; + pack_return (new math_view w) ~packing ~show +;; diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gtkMathView.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gtkMathView.ml new file mode 100644 index 000000000..2bedc2f1a --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gtkMathView.ml @@ -0,0 +1,120 @@ +open Gtk +open Gtk_mathview +open Tags +open GtkBase +open Gpointer + +external mDOMNode_of_boxed_option : + Gpointer.boxed option -> Minidom.mDOMNode = + "ml_gtk_math_view_mDOMNode_of_bodex_option" + +external mDOMNode_option_of_boxed_option : + Gpointer.boxed option -> Minidom.mDOMNode option = + "ml_gtk_math_view_mDOMNode_option_of_bodex_option" + +let o_mDOMNode_of_mDOMNode node = new Ominidom.o_mDOMNode node + +let o_mDOMNode_option_of_mDOMNode_option = + function + | Some x -> Some (o_mDOMNode_of_mDOMNode x) + | None -> None + +module MathView = struct + exception NoSelection + + type font_manager_id = FontManagerGtk | FontManagerT1 + + let cast w : math_view obj = Object.try_cast w "GtkMathView" + external create : Gtk.adjustment optobj -> Gtk.adjustment optobj -> + math_view obj = "ml_gtk_math_view_new" + let create ~adjustmenth ~adjustmentv () = + create (optboxed adjustmenth) (optboxed adjustmentv) + external load : [>`math_view] obj -> filename:string -> bool = + "ml_gtk_math_view_load" + external unload : [>`math_view] obj -> unit = + "ml_gtk_math_view_unload" + external raw_get_selection : [>`math_view] obj -> Minidom.mDOMNode option = + "ml_gtk_math_view_get_selection" + let has_selection obj = + match raw_get_selection obj with + | None -> false + | _ -> true + let get_selection obj = + match raw_get_selection obj with + | Some x -> o_mDOMNode_of_mDOMNode x + | None -> raise NoSelection + external raw_set_selection : [>`math_view] obj -> Minidom.mDOMNode option -> unit= + "ml_gtk_math_view_set_selection" + let set_selection obj (node : Ominidom.o_mDOMNode) = raw_set_selection obj (Some (node#get_dom_node)) + let reset_selection obj = raw_set_selection obj None + external get_width : [>`math_view] obj -> int = + "ml_gtk_math_view_get_width" + external get_height : [>`math_view] obj -> int = + "ml_gtk_math_view_get_height" + external get_top : [>`math_view] obj -> (int * int) = + "ml_gtk_math_view_get_top" + external set_top : [>`math_view] obj -> int -> int -> unit = + "ml_gtk_math_view_set_top" + external set_adjustments : [>`math_view] obj -> Gtk.adjustment obj -> Gtk.adjustment obj -> unit = + "ml_gtk_math_view_set_adjustments" + external get_hadjustment : [>`math_view] obj -> Gtk.adjustment obj = + "ml_gtk_math_view_get_hadjustment" + external get_vadjustment : [>`math_view] obj -> Gtk.adjustment obj = + "ml_gtk_math_view_get_vadjustment" + external get_buffer : [>`math_view] obj -> Gdk.pixmap = + "ml_gtk_math_view_get_buffer" + external get_frame : [>`math_view] obj -> [`frame] obj = + "ml_gtk_math_view_get_frame" + external set_font_size : [>`math_view] obj -> int -> unit = + "ml_gtk_math_view_set_font_size" + external get_font_size : [>`math_view] obj -> int = + "ml_gtk_math_view_get_font_size" + external set_anti_aliasing : [>`math_view] obj -> bool -> unit = + "ml_gtk_math_view_set_anti_aliasing" + external get_anti_aliasing : [>`math_view] obj -> bool = + "ml_gtk_math_view_get_anti_aliasing" + external set_kerning : [>`math_view] obj -> bool -> unit = + "ml_gtk_math_view_set_kerning" + external get_kerning : [>`math_view] obj -> bool = + "ml_gtk_math_view_get_kerning" + external set_log_verbosity : [>`math_view] obj -> int -> unit = + "ml_gtk_math_view_set_log_verbosity" + external get_log_verbosity : [>`math_view] obj -> int = + "ml_gtk_math_view_get_log_verbosity" + external export_to_postscript : + [>`math_view] obj -> width:int -> height:int -> x_margin:int -> y_margin:int -> disable_colors:bool + -> filename:string -> bool = + "ml_gtk_math_view_export_to_postscript_bytecode" "ml_gtk_math_view_export_to_postscript_native" + external get_font_manager_type : [>`math_view] obj -> font_manager_id = + "ml_gtk_math_view_get_font_manager_type" + external set_font_manager_type : [>`math_view] obj -> fm_type:font_manager_id -> unit = + "ml_gtk_math_view_set_font_manager_type" + + module Signals = struct + open GtkSignal + + let clicked : ([>`math_view],_) t = + let marshal_clicked f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_clicked" + in + { name = "clicked"; marshaller = marshal_clicked } + + let jump : ([>`math_view],_) t = + let marshal_jump f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_jump" + in + { name = "jump"; marshaller = marshal_jump } + + let selection_changed : ([>`math_view],_) t = + let marshal_selection_changed f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_option_of_mDOMNode_option (mDOMNode_option_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_selection_changed" + in + { name = "selection_changed"; marshaller = marshal_selection_changed } + end +end diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gtk_mathview.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gtk_mathview.ml new file mode 100644 index 000000000..745a1ba82 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/gtk_mathview.ml @@ -0,0 +1 @@ +type math_view = [`widget|`container|`bin|`eventbox|`math_view] diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/.cvsignore b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/.cvsignore new file mode 100644 index 000000000..84bdd8eff --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/.cvsignore @@ -0,0 +1 @@ +*.cmi *.cmo *.cmx test test.opt diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/Makefile b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/Makefile new file mode 100644 index 000000000..15f84731a --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/Makefile @@ -0,0 +1,48 @@ +LIBDIR = /usr/lib/ocaml +INSTALLDIR = $(LIBDIR)/minidom +OBJECTS = minidom.cmi minidom.cmo ml_minidom.o ominidom.cmo +OBJECTS_OPT = minidom.cmx ominidom.cmx +INST = minidom.o ominidom.o ml_minidom.h minidom.mli + +all: $(OBJECTS) test + +opt: $(OBJECTS_OPT) test.opt + +ml_minidom.o: ml_minidom.c + gcc -c -I/usr/lib/ocaml/caml/ `glib-config --cflags` `minidom-config --cflags` $< + +minidom.cmi: minidom.mli + ocamlc -c $< + +minidom.cmo: minidom.ml minidom.cmi + ocamlc -c $< + +minidom.cmx: minidom.ml minidom.cmi + ocamlopt -c $< + +ominidom.cmo: ominidom.ml + ocamlc -c $< + +ominidom.cmx: ominidom.ml + ocamlopt -c $< + +test.cmo: test.ml minidom.cmo + ocamlc -c test.ml + +test.cmx: test.ml minidom.cmx + ocamlopt -c test.ml + +test: test.cmo minidom.cmo ml_minidom.o + ocamlc -custom -o test minidom.cmo test.cmo ml_minidom.o \ + -cclib "`glib-config --libs` `minidom-config --libs`" + +test.opt: test.cmx minidom.cmx ml_minidom.o + ocamlopt -o test.opt minidom.cmx test.cmx ml_minidom.o \ + -cclib "`glib-config --libs` `minidom-config --libs`" + +install: + if test -d $(INSTALLDIR); then : ; else mkdir -p $(INSTALLDIR); fi + cp $(OBJECTS) $(OBJECTS_OPT) $(INSTALLDIR) + +clean: + rm -f *.o *.cm? test test.opt diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/minidom.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/minidom.ml new file mode 100644 index 000000000..31e677b3f --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/minidom.ml @@ -0,0 +1,61 @@ + +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)) + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/minidom.mli b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/minidom.mli new file mode 100644 index 000000000..0b655955b --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/minidom.mli @@ -0,0 +1,50 @@ + +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 : doc:mDOMDoc -> name:mDOMString -> content:mDOMString -> mDOMEntity = "ml_doc_add_entity" +external doc_get_entity : doc:mDOMDoc -> name:mDOMString -> mDOMEntity option = "ml_doc_get_entity" +external doc_get_predefined_entity : doc:mDOMDoc -> name: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 : node:mDOMNode -> name:mDOMString -> mDOMString option = "ml_node_get_attribute" +external node_get_attribute_ns : node:mDOMNode -> name:mDOMString -> ns_uri: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 + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ml_minidom.c b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ml_minidom.c new file mode 100644 index 000000000..10626143c --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ml_minidom.c @@ -0,0 +1,288 @@ + +#include +#include +#include + +#include "minidom.h" + +#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)) + +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_content(value node) +{ + CAMLparam1(node); + CAMLreturn(Val_option(mdom_node_get_content((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)); +} + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ml_minidom.h b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ml_minidom.h new file mode 100644 index 000000000..d22479964 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ml_minidom.h @@ -0,0 +1,18 @@ + +#ifndef ml_minidom_h +#define ml_minidom_h + +#define Val_ptr(p) ((value) (p)) +#ifndef Val_option +#define Val_option(p,f) ((p != NULL) ? ml_some(f(p)) : Val_unit) +#endif /* Val_option */ +#define Val_mDOMString(s) (copy_string((char*) (s))) +#define mDOMString_val(v) ((mDOMStringRef) String_val(v)) +#define mDOMNode_val(v) ((mDOMNodeRef) v) + +#define mDOMNode_option_mDOMNodeRef(p) (((p) != NULL) ? ml_some((value) (p)) : Val_unit) +#define mDOMNodeRef_mDOMNode_option(v) ((v == Val_unit) ? NULL : (mDOMNodeRef)Field((v),0)) +#define Val_mDOMNodeRef(p) (mDOMNode_option_mDOMNodeRef(p)) +#define mDOMNodeRef_val(v) (mDOMNodeRef_mDOMNode_option(v)) + +#endif /* ml_minidom_h */ diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ominidom.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ominidom.ml new file mode 100644 index 000000000..ed2ca1f9e --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/ominidom.ml @@ -0,0 +1,109 @@ + +exception Minidom_exception of string;; + +let option_to_exception v e = + match (v) with + Some x -> x + | None -> raise e +;; + +class o_mDOMString (str: Minidom.mDOMString) = + object + method get_dom_string = str + method get_string = Minidom.string_of_mDOMString str + end;; + +let o_mDOMString_of_string str = + new o_mDOMString (Minidom.mDOMString_of_string str) + +class o_mDOMDoc (doc : Minidom.mDOMDoc) = + object + method get_dom_doc = doc + + method get_root_node = Minidom.doc_get_root_node doc + method add_entity (name : o_mDOMString) content = + Minidom.doc_add_entity doc (name#get_dom_string) content + method get_entity (name : o_mDOMString) = + Minidom.doc_get_entity doc (name#get_dom_string) + method get_predefined_entity (name : o_mDOMString) = + Minidom.doc_get_predefined_entity doc (name#get_dom_string) + end;; + +class o_mDOMNode (node : Minidom.mDOMNode) = + object + method get_dom_node = node + + method is_text = Minidom.node_is_text node + method is_element = Minidom.node_is_element node + method is_blank = Minidom.node_is_blank node + method is_entity_ref = Minidom.node_is_entity_ref node + + method get_type = Minidom.node_get_type node + method get_name = + new o_mDOMString + (option_to_exception (Minidom.node_get_name node) (Minidom_exception "node has no name")) + method get_ns_uri = + new o_mDOMString + (option_to_exception (Minidom.node_get_ns_uri node) (Minidom_exception "node has no associated namepsace")) + method get_attribute (name : o_mDOMString) = + new o_mDOMString + (option_to_exception + (Minidom.node_get_attribute node (name#get_dom_string)) + (Minidom_exception "attribute not set for this node") + ) + method get_attribute_ns (name : o_mDOMString) (uri : o_mDOMString) = + new o_mDOMString + (option_to_exception + (Minidom.node_get_attribute_ns node (name#get_dom_string) (uri#get_dom_string)) + (Minidom_exception "attribute not set for this node") + ) + method get_content = + new o_mDOMString + (option_to_exception (Minidom.node_get_content node) (Minidom_exception "node has no content")) + method get_parent = + new o_mDOMNode + (option_to_exception (Minidom.node_get_parent node) (Minidom_exception "node has no parent")) + method get_prev_sibling = + new o_mDOMNode + (option_to_exception (Minidom.node_get_prev_sibling node) (Minidom_exception "node has no previous sibling")) + method get_next_sibling = + new o_mDOMNode + (option_to_exception (Minidom.node_get_next_sibling node) (Minidom_exception "node has no next sibling")) + method get_first_child = + new o_mDOMNode + (option_to_exception (Minidom.node_get_first_child node) (Minidom_exception "node has no children")) + method get_first_attribute = + new o_mDOMAttr + (option_to_exception (Minidom.node_get_first_attribute node) (Minidom_exception "node has no attributes")) + method is_first = Minidom.node_is_first node + method is_last = Minidom.node_is_last node + + method get_children = List.map (function x -> new o_mDOMNode x) (Minidom.node_get_children node) + method get_attributes = List.map (function x -> new o_mDOMAttr x) (Minidom.node_get_attributes node) + end +and o_mDOMAttr (attr : Minidom.mDOMAttr) = + object + method get_dom_attr = attr + + method get_name = + new o_mDOMString + (option_to_exception (Minidom.attr_get_name attr) (Minidom_exception "attribute has no name")) + method get_ns_uri = + new o_mDOMString + (option_to_exception (Minidom.attr_get_ns_uri attr) (Minidom_exception "attribute has no associated namespace")) + method get_value = + new o_mDOMString + (option_to_exception (Minidom.attr_get_value attr) (Minidom_exception "attribute has no value")) + + method get_prev_sibling = + new o_mDOMAttr + (option_to_exception (Minidom.attr_get_prev_sibling attr) (Minidom_exception "attribute has no previous sibling")) + method get_next_sibling = + new o_mDOMAttr + (option_to_exception (Minidom.attr_get_next_sibling attr) (Minidom_exception "attribute has no next sibling")) + method get_parent = + new o_mDOMNode + (option_to_exception (Minidom.attr_get_parent attr) (Minidom_exception "attribute has no parent")) + end +;; + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/test.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/test.ml new file mode 100644 index 000000000..3c7a092e9 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/test.ml @@ -0,0 +1,84 @@ + +let doc = Minidom.doc_load "test.xml" + +let root = Minidom.doc_get_root_node doc + +let check_attribute_ns attr = + Printf.printf "\n\n"; + let ns_uri = Minidom.attr_get_ns_uri attr + and attr_name = Minidom.attr_get_name attr + and attr_value = Minidom.attr_get_value attr + and parent = Minidom.attr_get_parent attr + in + match parent,ns_uri,attr_name,attr_value with + Some parent_node,Some uri,Some attribute_name,Some attribute_value -> + let attr_value = Minidom.node_get_attribute_ns parent_node attribute_name uri + in begin + match attr_value with + Some attr1 -> + Printf.printf "found the attribute with ns %s (was %s)\n" + (Minidom.string_of_mDOMString attr1) (Minidom.string_of_mDOMString attribute_value) + | None -> + Printf.printf "attribute not found (uri was %s)!!!!\n" (Minidom.string_of_mDOMString uri) + end + | _ -> + Printf.printf "parent_node == NULL || uri == NULL || attribute_name == NULL || attribute_value == NULL\n" +;; + +let print_attribute attr = + check_attribute_ns attr; + let ns_uri = Minidom.attr_get_ns_uri attr + in + begin + match ns_uri with + Some uri -> Printf.printf " %s:" (Minidom.string_of_mDOMString uri); + | None -> () + end; + match ((Minidom.attr_get_name attr), (Minidom.attr_get_value attr)) with + (Some attr_name, Some attr_value) -> + Printf.printf " %s=\"%s\"" (Minidom.string_of_mDOMString attr_name) (Minidom.string_of_mDOMString attr_value) + | (Some attr_name, _) -> + Printf.printf " ??? attribute %s has no value !!!" (Minidom.string_of_mDOMString attr_name) + | (_,_) -> + Printf.printf " ??? very strange attribute !!!" +;; + +let rec print_node n node = + if Minidom.node_is_blank node then () + else if Minidom.node_is_element node then begin + match Minidom.node_get_name node with + Some node_name -> + begin + let children = Minidom.node_get_children node + and attributes = Minidom.node_get_attributes node + and ns_uri = Minidom.node_get_ns_uri node + and is_first,is_last = (Minidom.node_is_first node), (Minidom.node_is_last node) + in + for i = 1 to n do print_char ' ' done; + Printf.printf "<"; + begin + match ns_uri with + Some uri -> Printf.printf "%s:" (Minidom.string_of_mDOMString uri) + | None -> () + end; + Printf.printf "%s" (Minidom.string_of_mDOMString node_name); + List.iter print_attribute attributes; + Printf.printf ">\n"; + List.iter (print_node (n + 2)) children; + for i = 1 to n do print_char ' ' done; + Printf.printf "\n" (Minidom.string_of_mDOMString node_name) + end + | None -> Printf.printf "??? this node has no name !!!\n" + end else if Minidom.node_is_text node then begin + match Minidom.node_get_content node with + Some node_content -> + for i = 1 to n do print_char ' ' done; + Printf.printf "%s\n" (Minidom.string_of_mDOMString node_content) + | None -> Printf.printf "??? this node has no content !!!\n" + end else begin + Printf.printf "don't know how to manage a node with type %d\n" (Minidom.node_get_type node) + end +;; + +print_node 0 root;; + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/test.xml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/test.xml new file mode 100644 index 000000000..83d2eef68 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/minidom/test.xml @@ -0,0 +1,505 @@ + + + + + + + + DEFINITION and_ind() OF TYPE + + + + + + + + __ + + + + + + + + ( + + + + + Π + A + : + + Prop + + + + + + + . + + + + + Π + B + : + + Prop + + + + + + + . + + + + + Π + P + : + + Prop + + + + + + + . + + + + + Π + f + : + + ( + A + + + ( + B + + P + ) + + ) + + + + + + + . + + Π + a + : + + ( + and + + _ + + A + + _ + + B + ) + + . + P + + + + + + + + + + + + + + + + + + + + + + + + + + + + :> + + Prop + + + + + + + + ) + + + + + + + + cast + + prod + + A + + + Prop + + + + + prod + + B + + + Prop + + + + + prod + + P + + + Prop + + + + + prod + + f + + + arrow + A + + arrow + B + P + + + + + + prod + + a + + + app + and + A + B + + + + P + + + + + + + Prop + + + + + + + + + + + AS + + + + + + + + __ + + + + + + + λ + A + : + + Prop + + + + + + + . + + + + + λ + B + : + + Prop + + + + + + + . + + + + + λ + P + : + + Prop + + + + + + + . + + + + + λ + f + : + + ( + A + + + ( + B + + P + ) + + ) + + + + + + + . + + + + + λ + a + : + + ( + and + + _ + + A + + _ + + B + ) + + + + + + + . + + < + P + > + CASES + + _ + + a + + _ + + OF + + ( + conj + + _ + + $1 + + _ + + $2 + ) + + + + ( + f + + _ + + $1 + + _ + + $2 + ) + + + _ + + END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A + + + Prop + + + + + + B + + + Prop + + + + + + P + + + Prop + + + + + + f + + + arrow + A + + arrow + B + P + + + + + + + a + + + app + and + A + B + + + + + mutcase + P + a + + app + conj + $1 + $2 + + + app + f + $1 + $2 + + + + + + + + + + + + + + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/ml_gtk_mathview.c b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/ml_gtk_mathview.c new file mode 100644 index 000000000..63ea13bf1 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/ml_gtk_mathview.c @@ -0,0 +1,136 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include "minidom/ml_minidom.h" + +/* : 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) + +#define FontManagerId_val(val) Int_val(val) +#define Val_FontManagerId(val) Val_int(val) + +ML_2 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_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_mDOMNodeRef) +ML_2 (gtk_math_view_set_selection, GtkMathView_val, mDOMNodeRef_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) +ML_2 (gtk_math_view_set_font_manager_type, GtkMathView_val, FontManagerId_val, Unit) +ML_1 (gtk_math_view_get_font_manager_type, GtkMathView_val, Val_FontManagerId) + +value +ml_gtk_math_view_export_to_postscript_native(value arg1, + value w, value h, value x0, value y0, value disable_colors, value arg2) +{ + CAMLparam5(arg1,w,h,x0,y0); + CAMLxparam2(disable_colors, arg2); + + char *filename; + FILE *fd; + int res; + filename = String_val (arg2); + if ((fd = fopen(filename, "w"))) { + gtk_math_view_export_to_postscript(GtkMathView_val (arg1), + Int_val(w), Int_val(h), Int_val(x0), Int_val(y0), Bool_val(disable_colors), 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_export_to_postscript_bytecode (value* arg, int argn) +{ + return ml_gtk_math_view_export_to_postscript_native(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6]); +} + +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; + CAMLlocal1 (tmp); + CAMLlocal1 (optval); + CAMLlocal1 (res); + + if (arg1==Val_int(0)) { + assert(0); + } else { + tmp = Field(arg1, 0); + nr = (mDOMNodeRef) Field(tmp, 1); + } + optval = Val_mDOMNodeRef(nr); + if (optval==Val_int(0)) { + assert(0); + } else { + res = Field(optval, 0); + } + + CAMLreturn(res); +} + +value ml_gtk_math_view_mDOMNode_option_of_bodex_option (value arg1) +{ + CAMLparam1(arg1); + + mDOMNodeRef nr; + CAMLlocal1 (tmp); + + if (arg1==Val_int(0)) { + nr=NULL; + } else { + tmp = Field(arg1, 0); + nr = (mDOMNodeRef) Field(tmp, 1); + } + + CAMLreturn(Val_mDOMNodeRef(nr)); +} diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/.cvsignore b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/.cvsignore new file mode 100644 index 000000000..1968614b7 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/.cvsignore @@ -0,0 +1 @@ +*.cmo *.cmi *.cmx t1lib.log test test.opt test.ps test.o diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/Makefile b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/Makefile new file mode 100644 index 000000000..d631d239f --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/Makefile @@ -0,0 +1,45 @@ +LABLGTK_DIR = /usr/lib/ocaml/lablgtk +LABLGTK_MATHVIEW_DIR = .. +MINIDOM_DIR = ../minidom +OCAMLC = ocamlc -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) \ + -I $(MINIDOM_DIR) -I mlmathview +OCAMLOPT = ocamlopt -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) \ + -I $(MINIDOM_DIR) -I mlmathview + +all: test +opt: test.opt + +test: test.cmo + $(OCAMLC) -custom -o test lablgtk.cma gtkInit.cmo \ + $(MINIDOM_DIR)/minidom.cmo \ + $(MINIDOM_DIR)/ominidom.cmo \ + $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cma \ + -cclib "$(MINIDOM_DIR)/ml_minidom.o" \ + test.cmo \ + -cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \ + -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \ + -L/usr/local/lib/gtkmathview -lgtkmathview \ + $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o" + +test.opt: test.cmx + $(OCAMLOPT) -o test.opt lablgtk.cmxa gtkInit.cmx \ + $(MINIDOM_DIR)/minidom.cmx \ + $(MINIDOM_DIR)/ominidom.cmx \ + $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cmxa \ + -cclib "$(MINIDOM_DIR)/ml_minidom.o" \ + test.cmx \ + -cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \ + -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \ + -L/usr/local/lib/gtkmathview -lgtkmathview \ + $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o" + +.SUFFIXES: .ml .mli .cmo .cmi .cmx +.ml.cmo: + $(OCAMLC) -c $< +.mli.cmi: + $(OCAMLC) -c $< +.ml.cmx: + $(OCAMLOPT) -c $< + +clean: + rm -f *.cm[iox] *.o test test.opt t1lib.log test.ps diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/t1.config b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/t1.config new file mode 100644 index 000000000..afb669e95 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/t1.config @@ -0,0 +1,3 @@ +ENCODING=. +AFM=/usr/share/texmf/fonts/afm/ +TYPE1=/usr/share/texmf/fonts/type1/bluesky/cm/:/usr/X11R6/lib/X11/fonts/Type1/:. diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/test.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/test.ml new file mode 100644 index 000000000..f54c3bb19 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/test.ml @@ -0,0 +1,309 @@ +(******************************************************************************) +(* Claudio Sacerdoti Coen *) +(* 25/09/2000 *) +(* *) +(* This is a simple test for the OCaml (LablGtk indeed) binding of the *) +(* MathView widget *) +(******************************************************************************) + +(* Callbacks *) +let jump (node : Ominidom.o_mDOMNode) = + let module O = Ominidom in + print_string ("jump: " ^ + (try + let href = node#get_attribute (O.o_mDOMString_of_string "href") in + href#get_string + with + O.Minidom_exception s -> "EXCEPTION: " ^ s + ) ^ "\n"); + flush stdout +;; + +let selection_changed mathview (node : Ominidom.o_mDOMNode option) = + let module O = Ominidom in + print_string ("selection_changed: " ^ + (match node with + None -> "selection_changed on nothing" + | Some node -> + try + mathview#set_selection node ; + let node_name = node#get_name in + node_name#get_string + with + O.Minidom_exception s -> "EXCEPTION: " ^ s + ) ^ "\n"); + flush stdout +;; + + +let clicked (node : Ominidom.o_mDOMNode) = + let module O = Ominidom in + print_string ("clicked: " ^ + (try + let node_name = node#get_name in + node_name#get_string + with + O.Minidom_exception s -> "EXCEPTION: " ^ s + ) ^ "\n"); + flush stdout +;; + + +let activate_t1 mathview () = + mathview#set_font_manager_type GtkMathView.MathView.FontManagerT1; + print_string "WIDGET SET WITH T1 FONTS\n" ; + flush stdout +;; + +let activate_gtk mathview () = + mathview#set_font_manager_type GtkMathView.MathView.FontManagerGtk; + print_string "WIDGET SET WITH GTK FONTS\n" ; + flush stdout +;; + +let get_font_manager_type mathview () = + print_string "CURRENT FONT MANAGER TYPE: "; + begin + match mathview#get_font_manager_type with + | GtkMathView.MathView.FontManagerT1 -> print_string "T1" + | GtkMathView.MathView.FontManagerGtk -> print_string "GTK" + end; + print_newline(); + flush stdout +;; + +let load mathview () = + mathview#load "test.xml" ; + print_string "load: SEEMS TO WORK\n" ; + flush stdout +;; + +let get_selection mathview () = + let module O = Ominidom in + let selection = + if not mathview#has_selection then "nothing" + else + let node = mathview#get_selection in + (try node#get_name#get_string + with + O.Minidom_exception s -> "EXCEPTION: " ^ s + ) + in + print_string ("get_selection: " ^ selection ^ "\n") ; + flush stdout +;; + +let set_selection mathview () = + let module O = Ominidom in + begin + try + let selected_node = mathview#get_selection in + try + let parent_node = selected_node#get_parent in + mathview#set_selection parent_node; + print_string "set selection: SEEMS TO WORK\n" + with + O.Minidom_exception s -> + print_string ("EXCEPTION: " ^ s ^ "\n") + with + GtkMathView.MathView.NoSelection -> + print_string "set_selection: YOU MUST PREVIOUSLY SELECT A NON-ROOT NODE\n" + end ; + flush stdout +;; + +let reset_selection mathview () = + mathview#reset_selection ; + print_string "reset_selection: SEEMS TO WORK\n" ; + flush stdout +;; + +let unload mathview () = + mathview#unload ; + print_string "unload: SEEMS TO WORK\n" ; + flush stdout +;; + +let get_width mathview () = + print_string ("get_width: " ^ string_of_int (mathview#get_width) ^ "\n") ; + flush stdout +;; + +let get_height mathview () = + print_string ("get_height: " ^ string_of_int (mathview#get_height) ^ "\n") ; + flush stdout +;; + +let get_top mathview () = + let (x,y) = mathview#get_top in + print_string ("get_top: ("^ string_of_int x ^ "," ^ string_of_int y ^ ")\n") ; + flush stdout +;; + +let set_top mathview () = + mathview#set_top 0 0; + print_string "set_top: SEEM TO WORK\n" ; + flush stdout +;; + +let set_adjustments mathview () = + let adj1 = GData.adjustment () in + let adj2 = GData.adjustment () in + mathview#set_adjustments adj1 adj2 ; + adj1#set_value ((adj1#lower +. adj1#upper) /. 2.0) ; + adj2#set_value ((adj2#lower +. adj2#upper) /. 2.0) ; + print_string "set_adjustments: SEEM TO WORK\n" ; + flush stdout +;; + +let get_hadjustment mathview () = + let adj = mathview#get_hadjustment in + adj#set_value ((adj#lower +. adj#upper) /. 2.0) ; + print_string "get_hadjustment: SEEM TO WORK\n" ; + flush stdout +;; + +let get_vadjustment mathview () = + let adj = mathview#get_vadjustment in + adj#set_value ((adj#lower +. adj#upper) /. 2.0) ; + print_string "get_vadjustment: SEEM TO WORK\n" ; + flush stdout +;; + +let get_buffer mathview () = + let buffer = mathview#get_buffer in + Gdk.Draw.rectangle buffer (Gdk.GC.create buffer) ~x:0 ~y:0 + ~width:50 ~height:50 ~filled:true () ; + print_string "get_buffer: SEEMS TO WORK (hint: force the widget redrawing)\n"; + flush stdout +;; + +let get_frame mathview () = + let frame = mathview#get_frame in + frame#set_shadow_type `NONE ; + print_string "get_frame: SEEMS TO WORK\n" ; + flush stdout +;; + +let set_font_size mathview () = + mathview#set_font_size 24 ; + print_string "set_font_size: FONT IS NOW 24\n" ; + flush stdout +;; + +let get_font_size mathview () = + print_string ("get_font_size: " ^ string_of_int (mathview#get_font_size) ^ "\n") ; + flush stdout +;; + +let set_anti_aliasing mathview () = + mathview#set_anti_aliasing true ; + print_string "set_anti_aliasing: ON\n" ; + flush stdout +;; + +let get_anti_aliasing mathview () = + print_string ("get_anti_aliasing: " ^ + (match mathview#get_anti_aliasing with true -> "ON" | false -> "OFF") ^ + "\n") ; + flush stdout +;; + +let set_kerning mathview () = + mathview#set_kerning true ; + print_string "set_kerning: ON\n" ; + flush stdout +;; + +let get_kerning mathview () = + print_string ("get_kerning: " ^ + (match mathview#get_kerning with true -> "ON" | false -> "OFF") ^ + "\n") ; + flush stdout +;; + +let set_log_verbosity mathview () = + mathview#set_log_verbosity 3 ; + print_string "set_log_verbosity: NOW IS 3\n" ; + flush stdout +;; + +let get_log_verbosity mathview () = + print_string ("get_log_verbosity: " ^ + string_of_int mathview#get_log_verbosity ^ + "\n") ; + flush stdout +;; + +let export_to_postscript mathview () = + mathview#export_to_postscript 595 822 72 72 false "test.ps" ; + print_string "expor_to_postscript: SEEMS TO WORK (hint: look at test.ps)\n"; + flush stdout +;; + +(* Widget creation *) +let main_window = GWindow.window ~title:"GtkMathView test" () in +let vbox = GPack.vbox ~packing:main_window#add () in +let sw = GBin.scrolled_window ~width:50 ~height:50 ~packing:vbox#pack () in +let mathview= GMathView.math_view ~packing:sw#add ~width:50 ~height:50 () in +let table = GPack.table ~rows:6 ~columns:5 ~packing:vbox#pack () in +let button_gtk=GButton.button ~label:"activate Gtk fonts" ~packing:(table#attach ~left:0 ~top:0) () in +let button_load = GButton.button ~label:"load" ~packing:(table#attach ~left:1 ~top:0) () in +let button_unload = GButton.button ~label:"unload" ~packing:(table#attach ~left:2 ~top:0) () in +let button_get_selection = GButton.button ~label:"get_selection" ~packing:(table#attach ~left:3 ~top:0) () in +let button_set_selection = GButton.button ~label:"set_selection" ~packing:(table#attach ~left:4 ~top:0) () in +let button_get_width = GButton.button ~label:"get_width" ~packing:(table#attach ~left:0 ~top:1) () in +let button_get_height = GButton.button ~label:"get_height" ~packing:(table#attach ~left:1 ~top:1) () in +let button_get_top = GButton.button ~label:"get_top" ~packing:(table#attach ~left:2 ~top:1) () in +let button_set_top = GButton.button ~label:"set_top" ~packing:(table#attach ~left:3 ~top:1) () in +let button_set_adjustments = GButton.button ~label:"set_adjustments" ~packing:(table#attach ~left:4 ~top:1) () in +let button_get_hadjustment = GButton.button ~label:"get_hadjustment" ~packing:(table#attach ~left:0 ~top:2) () in +let button_get_vadjustment = GButton.button ~label:"get_vadjustment" ~packing:(table#attach ~left:1 ~top:2) () in +let button_get_buffer = GButton.button ~label:"get_buffer" ~packing:(table#attach ~left:2 ~top:2) () in +let button_get_frame = GButton.button ~label:"get_frame" ~packing:(table#attach ~left:3 ~top:2) () in +let button_set_font_size = GButton.button ~label:"set_font_size" ~packing:(table#attach ~left:4 ~top:2) () in +let button_get_font_size = GButton.button ~label:"get_font_size" ~packing:(table#attach ~left:0 ~top:3) () in +let button_set_anti_aliasing = GButton.button ~label:"set_anti_aliasing" ~packing:(table#attach ~left:1 ~top:3) () in +let button_get_anti_aliasing = GButton.button ~label:"get_anti_aliasing" ~packing:(table#attach ~left:2 ~top:3) () in +let button_set_kerning = GButton.button ~label:"set_kerning" ~packing:(table#attach ~left:3 ~top:3) () in +let button_get_kerning = GButton.button ~label:"get_kerning" ~packing:(table#attach ~left:4 ~top:3) () in +let button_set_log_verbosity = GButton.button ~label:"set_log_verbosity" ~packing:(table#attach ~left:0 ~top:4) () in +let button_get_log_verbosity = GButton.button ~label:"get_log_verbosity" ~packing:(table#attach ~left:1 ~top:4) () in +let button_export_to_postscript = GButton.button ~label:"export_to_postscript" ~packing:(table#attach ~left:2 ~top:4) () in +let button_t1 = GButton.button ~label:"activate T1 fonts" ~packing:(table#attach ~left:3 ~top:4) () in +let button_get_font_manager_type = GButton.button ~label:"get_font_manager" ~packing:(table#attach ~left:4 ~top:4) () in +let button_reset_selection = GButton.button ~label:"reset_selection" ~packing:(table#attach ~left:0 ~top:5) () in +(* Signals connection *) +ignore(button_gtk#connect#clicked (activate_gtk mathview)) ; +ignore(button_load#connect#clicked (load mathview)) ; +ignore(button_unload#connect#clicked (unload mathview)) ; +ignore(button_get_selection#connect#clicked (get_selection mathview)) ; +ignore(button_set_selection#connect#clicked (set_selection mathview)) ; +ignore(button_reset_selection#connect#clicked (reset_selection mathview)) ; +ignore(button_get_width#connect#clicked (get_width mathview)) ; +ignore(button_get_height#connect#clicked (get_height mathview)) ; +ignore(button_get_top#connect#clicked (get_top mathview)) ; +ignore(button_set_top#connect#clicked (set_top mathview)) ; +ignore(button_set_adjustments#connect#clicked (set_adjustments mathview)) ; +ignore(button_get_hadjustment#connect#clicked (get_hadjustment mathview)) ; +ignore(button_get_vadjustment#connect#clicked (get_vadjustment mathview)) ; +ignore(button_get_buffer#connect#clicked (get_buffer mathview)) ; +ignore(button_get_frame#connect#clicked (get_frame mathview)) ; +ignore(button_set_font_size#connect#clicked (set_font_size mathview)) ; +ignore(button_get_font_size#connect#clicked (get_font_size mathview)) ; +ignore(button_set_anti_aliasing#connect#clicked (set_anti_aliasing mathview)) ; +ignore(button_get_anti_aliasing#connect#clicked (get_anti_aliasing mathview)) ; +ignore(button_set_kerning#connect#clicked (set_kerning mathview)) ; +ignore(button_get_kerning#connect#clicked (get_kerning mathview)) ; +ignore(button_set_log_verbosity#connect#clicked (set_log_verbosity mathview)) ; +ignore(button_get_log_verbosity#connect#clicked (get_log_verbosity mathview)) ; +ignore(button_export_to_postscript#connect#clicked (export_to_postscript mathview)) ; +ignore(button_t1#connect#clicked (activate_t1 mathview)) ; +ignore(button_get_font_manager_type#connect#clicked (get_font_manager_type mathview)) ; +ignore(mathview#connect#jump jump) ; +ignore(mathview#connect#clicked clicked) ; +ignore(mathview#connect#selection_changed (selection_changed mathview)) ; +(* Main Loop *) +main_window#show () ; +GMain.Main.main () +;; diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/test.xml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/test.xml new file mode 100644 index 000000000..b0f8c1563 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20000829_gtkmathview-0.2.1/test/test.xml @@ -0,0 +1,123 @@ + + + + + + + + a + + x + + + + b + + + + x + 2 + + + + + p + + x + + + + q + + + + d + x + = + + + a2 + + + ln + + + ( + + x2 + + + + p + + x + + + + q + + ) + + + + + + + + + + 2 + + b + + - + + a + + p + + + + + + 4 + + q + + - + + p + 2 + + + + + + + arctg + + + + + 2 + + x + + + + p + + + + + 4 + + q + + - + + p + 2 + + + + + + + + + c + + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/.cvsignore b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/.cvsignore new file mode 100644 index 000000000..cd9e25037 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/.cvsignore @@ -0,0 +1 @@ +*.cmi *.cmo *.cmx *.cma *.cmxa config.make diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/.depend b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/.depend new file mode 100644 index 000000000..600449bb8 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/.depend @@ -0,0 +1,4 @@ +gMathView.cmo: gtkMathView.cmo gtk_mathview.cmo +gMathView.cmx: gtkMathView.cmx gtk_mathview.cmx +gtkMathView.cmo: gtk_mathview.cmo +gtkMathView.cmx: gtk_mathview.cmx diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/COPYING b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/COPYING new file mode 100644 index 000000000..20b480a10 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/COPYING @@ -0,0 +1,11 @@ +This library is made available under the LGPL. +You should have got a copy of the LGPL with Objective Caml. +The LGPL applies to all the files in this directory, but not in +subdirectories. + +For the test subdirectory, there is no specific licensing policy, +but you may freely take inspiration from the code, and copy parts of +it in your application. + +Author: + Claudio Sacerdoti Coen diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/Makefile b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/Makefile new file mode 100644 index 000000000..b8adbb47b --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/Makefile @@ -0,0 +1,109 @@ +# Makefile for lablgtk_mathview. + +LABLGTKDIR = /usr/lib/ocaml/lablgtk +MINIDOMDIR = ./minidom +TESTDIR = ./test +MLFLAGS += -I $(LABLGTKDIR) -I $(MINIDOMDIR) + +TARGETS = ml_gtk_mathview.o lablgtkmathview.cma + +all: Minidom $(TARGETS) + +opt: Minidom.opt lablgtkmathviewopt + +Minidom: + cd $(MINIDOMDIR); make + +Minidom.opt: + cd $(MINIDOMDIR); make opt + +configure: + @rm -f config.make + @$(MAKE) --no-print-directory -f configure.mk + +depend: + @rm -f .depend + @$(MAKE) --no-print-directory -f configure.mk .depend + +.depend config.make: + @$(MAKE) --no-print-directory -f configure.mk + +COMPILER = $(CAMLC) $(MLFLAGS) -w s -labels -c +LINKER = $(CAMLC) $(MLFLAGS) +COMPOPT = $(CAMLOPT) $(MLFLAGS) -w s -labels -c +LINKOPT = $(CAMLOPT) $(MLFLAGS) + +include config.make + +INSTALLDIR = $(LIBDIR)/lablgtk/mathview + +MLLIBS = lablgtkmathview.cma +CLIBS = +MLLINK = unix.cma str.cma + +ifdef DEBUG +CFLAGS = -g $(GTKCFLAGS) +MLLINK += -cclib -lcamlrund +MLFLAGS += -g +else +CFLAGS = -O -DGTK_NO_CHECK_CASTS -DGTK_DISABLE_COMPAT_H $(GTKCFLAGS) +endif +CFLAGS += $(MINIDOMCFLAGS) $(GTKMATHVIEWCFLAGS) + +THFLAGS = -thread +THLINK = unix.cma threads.cma + +ifdef USE_CC +CCOMPILER = $(CC) -c -I$(LIBDIR) $(CFLAGS) +else +CCOMPILER = ocamlc -c -ccopt "$(CFLAGS)" +endif + +# Rules +.SUFFIXES: .ml .mli .cmo .cmi .cmx .c .o .var .h .opt .def +.c.o: + $(CCOMPILER) $< +.ml.cmo: + $(COMPILER) $< +.mli.cmi: + $(COMPILER) $< +.ml.cmx: + $(COMPOPT) $< +.var.h: + ./var2def < $< > $@ +.var.c: + ./var2conv < $< > $@ + +# Targets +COBJS = ml_gtk_mathview.o +MLOBJS = gtk_mathview.cmo gtkMathView.cmo gMathView.cmo +ALLOBJS = $(MLOBJS) + +lablgtkmathviewopt: $(CLIBS) $(MLLIBS:.cma=.cmxa) + +install: + if test -d $(INSTALLDIR); then : ; else mkdir -p $(INSTALLDIR); fi + cp $(ALLOBJS:.cmo=.cmi) $(INSTALLDIR) + if test -f *.mli ; then cp *.mli $(INSTALLDIR) ; fi + cp $(ALLOBJS:.cmo=.ml) $(INSTALLDIR) + cp $(MLLIBS) $(INSTALLDIR) + cp $(COBJS) $(INSTALLDIR) + if test ! -z "$(CLIBS)" ; then cp $(CLIBS) $(INSTALLDIR) ; fi + if test -f lablgtkmathview.cmxa; then \ + cp $(MLLIBS:.cma=.cmxa) $(MLLIBS:.cma=.a) \ + $(INSTALLDIR); fi + +lablgtkmathview.cma: $(MLOBJS) + $(LINKER) -a -custom -o $@ $(MLOBJS) $(GTKLIBS) -cclib "$(GTKMATHVIEWLIBS)" -cclib "$(MINIDOMLIBS)" +lablgtkmathview.cmxa: $(MLOBJS:.cmo=.cmx) + $(LINKOPT) -a -o $@ $(MLOBJS:.cmo=.cmx) $(GTKLIBS) -cclib "$(GTKMATHVIEWLIBS)" -cclib "$(MINIDOMLIBS)" + +ml_gtk.o: $(LABLGTKDIR)/gtk_tags.c $(LABLGTKDIR)/gtk_tags.h \ + $(LABLGTKDIR)/ml_gtk.h $(LABLGTKDIR)/ml_gdk.h $(LABLGTKDIR)/wrappers.h + +clean: + rm -f *.cm* *.o *.a *_tags.[ch] $(TARGETS) + cd $(MINIDOMDIR); make clean + cd $(TESTDIR); make clean + +include .depend diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/configure.mk b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/configure.mk new file mode 100644 index 000000000..8982371ee --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/configure.mk @@ -0,0 +1,59 @@ +# makefile for configuring lablGTK_mathview + +# Default compilers +CAMLC = ocamlc +CAMLOPT = ocamlopt + +# Default installation directories +BINDIR = `$(GETBINDIR)` +INSTALLDIR = $(LIBDIR)/lablgtk/mathview + +# Autoconf +GETLIBDIR = ocamlc -v | grep "^Standard" | sed 's/^.*: *//' +LIBDIR = `$(GETLIBDIR)` +GETBINDIR = $(GETLIBDIR) | sed -e 's|/lib/[^/]*$$|/bin|' -e 's|/lib$$|/bin|' +GETRANLIB = which ranlib 2>/dev/null | sed -e 's|.*/ranlib$$|!|' -e 's/^[^!]*$$/:/' -e 's/!/ranlib/' + +ifdef USE_GNOME +GTKGETCFLAGS = gtk-config --cflags`" -I"`gnome-config --includedir +GNOMELIBS = `gnome-config --libs gtkxmhtml` +else +GTKGETCFLAGS = gtk-config --cflags +endif + +GTKGETLIBS = gtk-config --libs + +configure: .depend config.make + +.depend: + ocamldep *.ml *.mli > .depend + +config.make: + @echo CAMLC=$(CAMLC) > config.make + @echo CAMLOPT=$(CAMLOPT) >> config.make + @echo USE_GL=$(USE_GL) >> config.make + @echo USE_GNOME=$(USE_GNOME) >> config.make + @echo USE_CC=$(USE_CC) >> config.make + @echo DEBUG=$(DEBUG) >> config.make + @echo CC=$(CC) >> config.make + @echo RANLIB=`$(GETRANLIB)` >> config.make + @echo LIBDIR=$(LIBDIR) >> config.make + @echo BINDIR=`$(GETBINDIR)` >> config.make + @echo INSTALLDIR=$(INSTALLDIR) >> config.make +# Luca: was +# @echo GTKCFLAGS=`$(GTKGETCFLAGS)` -I/usr/lib/ocaml/lablgtk >> config.make +# Luca: now + @echo GTKCFLAGS=`$(GTKGETCFLAGS)` -I$(LIBDIR)/lablgtk >> config.make + @echo GTKLIBS=`$(GTKGETLIBS)` | \ + sed -e 's/-l/-cclib &/g' -e 's/-[LRWr][^ ]*/-ccopt &/g' \ + >> config.make +# Luca: GtkMathView configuration + @echo GTKMATHVIEWCFLAGS=`gtkmathview-config --cflags` >> config.make + @echo MINIDOMCFLAGS=`minidom-config --cflags` >> config.make + @echo GTKMATHVIEWLIBS=`gtkmathview-config --libs` >> config.make + @echo MINIDOMLIBS=`minidom-config --libs` >> config.make +# Luca: end of GtkMathView configuration + @echo GNOMELIBS=$(GNOMELIBS) | \ + sed -e 's/-l/-cclib &/g' -e 's/-[LRWr][^ ]*/-ccopt &/g' \ + >> config.make + cat config.make diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gMathView.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gMathView.ml new file mode 100644 index 000000000..e897ccfdb --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gMathView.ml @@ -0,0 +1,80 @@ +open Gaux +open Gtk +open Gtk_mathview +open GtkBase +open GtkMathView +open GObj + +exception ErrorLoadingFile of string;; +exception ErrorWritingFile of string;; +exception NoSelection;; + +class math_view_signals obj = object + inherit GContainer.container_signals obj + method clicked = GtkSignal.connect ~sgn:MathView.Signals.clicked obj ~after + method jump = GtkSignal.connect ~sgn:MathView.Signals.jump obj ~after + method selection_changed = + GtkSignal.connect ~sgn:MathView.Signals.selection_changed obj ~after +end + +class math_view obj = object + inherit GContainer.container (obj : Gtk_mathview.math_view obj) + method connect = new math_view_signals obj + method load ~filename = + if not (MathView.load obj ~filename) then raise (ErrorLoadingFile filename) + method unload = MathView.unload obj + method get_selection = MathView.get_selection obj + method set_selection (node : Ominidom.o_mDOMNode option) = MathView.set_selection obj node + method get_width = MathView.get_width obj + method get_height = MathView.get_height obj + method get_top = MathView.get_top obj + method set_top = MathView.set_top obj + method set_adjustments = + fun adj1 adj2 -> + MathView.set_adjustments obj (GData.as_adjustment adj1) + (GData.as_adjustment adj2) + method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj) + method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj) + method get_buffer = MathView.get_buffer obj + method get_frame = new GBin.frame (MathView.get_frame obj) + method set_font_size = MathView.set_font_size obj + method get_font_size = MathView.get_font_size obj + method set_anti_aliasing = MathView.set_anti_aliasing obj + method get_anti_aliasing = MathView.get_anti_aliasing obj + method set_kerning = MathView.set_kerning obj + method get_kerning = MathView.get_kerning obj + method set_log_verbosity = MathView.set_log_verbosity obj + method get_log_verbosity = MathView.get_log_verbosity obj + method export_to_postscript + ?(width = 595) ?(height = 822) ?(x_margin = 72) ?(y_margin = 72) + ?(disable_colors = false) ~filename () = + let result = MathView.export_to_postscript obj + ~width ~height ~x_margin ~y_margin ~disable_colors ~filename + in + if not result then raise (ErrorWritingFile filename) + method get_font_manager_type = MathView.get_font_manager_type obj + method set_font_manager_type ~fm_type = MathView.set_font_manager_type obj ~fm_type +end + +let math_view ?adjustmenth ?adjustmentv ?font_size ?font_manager ?border_width + ?width ?height ?packing ?show () = + let w = + MathView.create + ?adjustmenth:(may_map ~f:GData.as_adjustment adjustmenth) + ?adjustmentv:(may_map ~f:GData.as_adjustment adjustmentv) + () + in + Container.set w ?border_width ?width ?height; + let mathview = pack_return (new math_view w) ~packing ~show in + begin + match font_size with + | Some size -> mathview#set_font_size size + | None -> () + end; + begin + match font_manager with + | Some manager -> mathview#set_font_manager_type ~fm_type:manager + | None -> () + end; + mathview +;; diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gtkMathView.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gtkMathView.ml new file mode 100644 index 000000000..4c893fab4 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gtkMathView.ml @@ -0,0 +1,118 @@ +open Gtk +open Gtk_mathview +open Tags +open GtkBase +open Gpointer + +external mDOMNode_of_boxed_option : + Gpointer.boxed option -> Minidom.mDOMNode = + "ml_gtk_math_view_mDOMNode_of_bodex_option" + +external mDOMNode_option_of_boxed_option : + Gpointer.boxed option -> Minidom.mDOMNode option = + "ml_gtk_math_view_mDOMNode_option_of_bodex_option" + +let o_mDOMNode_of_mDOMNode node = new Ominidom.o_mDOMNode node + +let o_mDOMNode_option_of_mDOMNode_option = + function + | Some x -> Some (o_mDOMNode_of_mDOMNode x) + | None -> None + +let mDOMNode_option_of_o_mDOMNode_option = + function + | Some x -> Some (x#get_dom_node) + | None -> None + +module MathView = struct + exception NoSelection + + let cast w : math_view obj = Object.try_cast w "GtkMathView" + external create : Gtk.adjustment optobj -> Gtk.adjustment optobj -> + math_view obj = "ml_gtk_math_view_new" + let create ~adjustmenth ~adjustmentv () = + create (optboxed adjustmenth) (optboxed adjustmentv) + external load : [>`math_view] obj -> filename:string -> bool = + "ml_gtk_math_view_load" + external unload : [>`math_view] obj -> unit = + "ml_gtk_math_view_unload" + external raw_get_selection : [>`math_view] obj -> Minidom.mDOMNode option = + "ml_gtk_math_view_get_selection" + let get_selection obj = + o_mDOMNode_option_of_mDOMNode_option (raw_get_selection obj) + external raw_set_selection : [>`math_view] obj -> Minidom.mDOMNode option -> unit= + "ml_gtk_math_view_set_selection" + let set_selection obj node = + raw_set_selection obj (mDOMNode_option_of_o_mDOMNode_option node) + external get_width : [>`math_view] obj -> int = + "ml_gtk_math_view_get_width" + external get_height : [>`math_view] obj -> int = + "ml_gtk_math_view_get_height" + external get_top : [>`math_view] obj -> (int * int) = + "ml_gtk_math_view_get_top" + external set_top : [>`math_view] obj -> int -> int -> unit = + "ml_gtk_math_view_set_top" + external set_adjustments : [>`math_view] obj -> Gtk.adjustment obj -> Gtk.adjustment obj -> unit = + "ml_gtk_math_view_set_adjustments" + external get_hadjustment : [>`math_view] obj -> Gtk.adjustment obj = + "ml_gtk_math_view_get_hadjustment" + external get_vadjustment : [>`math_view] obj -> Gtk.adjustment obj = + "ml_gtk_math_view_get_vadjustment" + external get_buffer : [>`math_view] obj -> Gdk.pixmap = + "ml_gtk_math_view_get_buffer" + external get_frame : [>`math_view] obj -> [`frame] obj = + "ml_gtk_math_view_get_frame" + external set_font_size : [>`math_view] obj -> int -> unit = + "ml_gtk_math_view_set_font_size" + external get_font_size : [>`math_view] obj -> int = + "ml_gtk_math_view_get_font_size" + external set_anti_aliasing : [>`math_view] obj -> bool -> unit = + "ml_gtk_math_view_set_anti_aliasing" + external get_anti_aliasing : [>`math_view] obj -> bool = + "ml_gtk_math_view_get_anti_aliasing" + external set_kerning : [>`math_view] obj -> bool -> unit = + "ml_gtk_math_view_set_kerning" + external get_kerning : [>`math_view] obj -> bool = + "ml_gtk_math_view_get_kerning" + external set_log_verbosity : [>`math_view] obj -> int -> unit = + "ml_gtk_math_view_set_log_verbosity" + external get_log_verbosity : [>`math_view] obj -> int = + "ml_gtk_math_view_get_log_verbosity" + external export_to_postscript : + [>`math_view] obj -> width:int -> height:int -> x_margin:int -> y_margin:int -> disable_colors:bool -> filename:string -> bool = + "ml_gtk_math_view_export_to_postscript_bytecode" "ml_gtk_math_view_export_to_postscript_native" + external get_font_manager_type : [>`math_view] obj -> + [`font_manager_gtk | `font_manager_t1] = + "ml_gtk_math_view_get_font_manager_type" + external set_font_manager_type : [>`math_view] obj -> + fm_type:[`font_manager_gtk | `font_manager_t1] -> unit = + "ml_gtk_math_view_set_font_manager_type" + + module Signals = struct + open GtkSignal + + let clicked : ([>`math_view],_) t = + let marshal_clicked f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_clicked" + in + { name = "clicked"; marshaller = marshal_clicked } + + let jump : ([>`math_view],_) t = + let marshal_jump f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_jump" + in + { name = "jump"; marshaller = marshal_jump } + + let selection_changed : ([>`math_view],_) t = + let marshal_selection_changed f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_option_of_mDOMNode_option (mDOMNode_option_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_selection_changed" + in + { name = "selection_changed"; marshaller = marshal_selection_changed } + end +end diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gtk_mathview.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gtk_mathview.ml new file mode 100644 index 000000000..745a1ba82 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/gtk_mathview.ml @@ -0,0 +1 @@ +type math_view = [`widget|`container|`bin|`eventbox|`math_view] diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/.cvsignore b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/.cvsignore new file mode 100644 index 000000000..84bdd8eff --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/.cvsignore @@ -0,0 +1 @@ +*.cmi *.cmo *.cmx test test.opt diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/Makefile b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/Makefile new file mode 100644 index 000000000..6fe73af6a --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/Makefile @@ -0,0 +1,51 @@ +LIBDIR = /usr/lib/ocaml +INSTALLDIR = $(LIBDIR)/minidom +OBJECTS = minidom.cmi minidom.cmo ml_minidom.o ominidom.cmi ominidom.cmo +OBJECTS_OPT = minidom.cmx ominidom.cmx +INST = minidom.o ominidom.o ml_minidom.h minidom.mli + +all: $(OBJECTS) test + +opt: $(OBJECTS_OPT) test.opt + +ml_minidom.o: ml_minidom.c + gcc -c -I/usr/lib/ocaml/caml/ `glib-config --cflags` `minidom-config --cflags` $< + +minidom.cmi: minidom.mli + ocamlc -c $< + +minidom.cmo: minidom.ml minidom.cmi + ocamlc -c $< + +minidom.cmx: minidom.ml minidom.cmi + ocamlopt -c $< + +ominidom.cmi: ominidom.mli + ocamlc -c $< + +ominidom.cmo: ominidom.ml + ocamlc -c $< + +ominidom.cmx: ominidom.ml + ocamlopt -c $< + +test.cmo: test.ml minidom.cmo + ocamlc -c test.ml + +test.cmx: test.ml minidom.cmx + ocamlopt -c test.ml + +test: test.cmo minidom.cmo ml_minidom.o + ocamlc -custom -o test minidom.cmo test.cmo ml_minidom.o \ + -cclib "`glib-config --libs` `minidom-config --libs`" + +test.opt: test.cmx minidom.cmx ml_minidom.o + ocamlopt -o test.opt minidom.cmx test.cmx ml_minidom.o \ + -cclib "`glib-config --libs` `minidom-config --libs`" + +install: + if test -d $(INSTALLDIR); then : ; else mkdir -p $(INSTALLDIR); fi + cp $(OBJECTS) $(OBJECTS_OPT) $(INST) $(INSTALLDIR) + +clean: + rm -f *.o *.cm? test test.opt diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/minidom.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/minidom.ml new file mode 100644 index 000000000..31e677b3f --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/minidom.ml @@ -0,0 +1,61 @@ + +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)) + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/minidom.mli b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/minidom.mli new file mode 100644 index 000000000..0b655955b --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/minidom.mli @@ -0,0 +1,50 @@ + +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 : doc:mDOMDoc -> name:mDOMString -> content:mDOMString -> mDOMEntity = "ml_doc_add_entity" +external doc_get_entity : doc:mDOMDoc -> name:mDOMString -> mDOMEntity option = "ml_doc_get_entity" +external doc_get_predefined_entity : doc:mDOMDoc -> name: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 : node:mDOMNode -> name:mDOMString -> mDOMString option = "ml_node_get_attribute" +external node_get_attribute_ns : node:mDOMNode -> name:mDOMString -> ns_uri: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 + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ml_minidom.c b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ml_minidom.c new file mode 100644 index 000000000..10626143c --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ml_minidom.c @@ -0,0 +1,288 @@ + +#include +#include +#include + +#include "minidom.h" + +#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)) + +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_content(value node) +{ + CAMLparam1(node); + CAMLreturn(Val_option(mdom_node_get_content((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)); +} + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ml_minidom.h b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ml_minidom.h new file mode 100644 index 000000000..d22479964 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ml_minidom.h @@ -0,0 +1,18 @@ + +#ifndef ml_minidom_h +#define ml_minidom_h + +#define Val_ptr(p) ((value) (p)) +#ifndef Val_option +#define Val_option(p,f) ((p != NULL) ? ml_some(f(p)) : Val_unit) +#endif /* Val_option */ +#define Val_mDOMString(s) (copy_string((char*) (s))) +#define mDOMString_val(v) ((mDOMStringRef) String_val(v)) +#define mDOMNode_val(v) ((mDOMNodeRef) v) + +#define mDOMNode_option_mDOMNodeRef(p) (((p) != NULL) ? ml_some((value) (p)) : Val_unit) +#define mDOMNodeRef_mDOMNode_option(v) ((v == Val_unit) ? NULL : (mDOMNodeRef)Field((v),0)) +#define Val_mDOMNodeRef(p) (mDOMNode_option_mDOMNodeRef(p)) +#define mDOMNodeRef_val(v) (mDOMNodeRef_mDOMNode_option(v)) + +#endif /* ml_minidom_h */ diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ominidom.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ominidom.ml new file mode 100644 index 000000000..85ad2e4ed --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ominidom.ml @@ -0,0 +1,156 @@ + +exception Node_has_no_parent;; +exception Node_has_no_sibling of string;; +exception Node_has_no_children;; +exception Node_has_no_attributes;; +exception Attribute_has_no_sibling of string;; +exception Attribute_has_no_parent;; +exception Undefined_entity;; + +let option_to_exception v e = + match v with + Some x -> x + | None -> raise e +;; + +class o_mDOMString (str: Minidom.mDOMString) = + object + method get_dom_string = str + method get_string = Minidom.string_of_mDOMString str + end;; + +let o_mDOMString_of_string str = + new o_mDOMString (Minidom.mDOMString_of_string str) + +class o_mDOMEntity (ent : Minidom.mDOMEntity) = + object + method get_dom_entity = ent + method get_content = + new o_mDOMString (Minidom.entity_get_content ent) + end +;; + +class o_mDOMDoc (doc : Minidom.mDOMDoc) = + object + method get_dom_doc = doc + + method get_root_node = + new o_mDOMNode (Minidom.doc_get_root_node doc) + method add_entity (name : o_mDOMString) (value : o_mDOMString) = + new o_mDOMEntity + (Minidom.doc_add_entity doc + (name#get_dom_string) (value#get_dom_string) + ) + method get_entity (name : o_mDOMString) = + match Minidom.doc_get_entity doc (name#get_dom_string) with + | Some x -> new o_mDOMEntity x + | None -> raise Undefined_entity + method get_predefined_entity (name : o_mDOMString) = + match Minidom.doc_get_predefined_entity doc (name#get_dom_string) with + | Some x -> new o_mDOMEntity x + | None -> raise Undefined_entity + end +and o_mDOMNode (node : Minidom.mDOMNode) = + object + method get_dom_node = node + + method is_text = Minidom.node_is_text node + method is_element = Minidom.node_is_element node + method is_blank = Minidom.node_is_blank node + method is_entity_ref = Minidom.node_is_entity_ref node + + method get_type = Minidom.node_get_type node + method get_name = + match Minidom.node_get_name node with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_ns_uri = + match Minidom.node_get_ns_uri node with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_attribute (name : o_mDOMString) = + match Minidom.node_get_attribute node (name#get_dom_string) with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_attribute_ns (name : o_mDOMString) (uri : o_mDOMString) = + match + Minidom.node_get_attribute_ns node + (name#get_dom_string) (uri#get_dom_string) + with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_content = + match Minidom.node_get_content node with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_parent = + new o_mDOMNode + (option_to_exception (Minidom.node_get_parent node) Node_has_no_parent) + method get_prev_sibling = + new o_mDOMNode + (option_to_exception + (Minidom.node_get_prev_sibling node) + (Node_has_no_sibling "left") + ) + method get_next_sibling = + new o_mDOMNode + (option_to_exception + (Minidom.node_get_next_sibling node) + (Node_has_no_sibling "right") + ) + method get_first_child = + new o_mDOMNode + (option_to_exception + (Minidom.node_get_first_child node) + (Node_has_no_children) + ) + method get_first_attribute = + new o_mDOMAttr + (option_to_exception + (Minidom.node_get_first_attribute node) + (Node_has_no_attributes) + ) + method is_first = Minidom.node_is_first node + method is_last = Minidom.node_is_last node + + method get_children = + List.map (function x -> new o_mDOMNode x) (Minidom.node_get_children node) + method get_attributes = List.map + (function x -> new o_mDOMAttr x) (Minidom.node_get_attributes node) + end +and o_mDOMAttr (attr : Minidom.mDOMAttr) = + object + method get_dom_attr = attr + + method get_name = + match Minidom.attr_get_name attr with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_ns_uri = + match Minidom.attr_get_ns_uri attr with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_value = + match Minidom.attr_get_value attr with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_prev_sibling = + new o_mDOMAttr + (option_to_exception + (Minidom.attr_get_prev_sibling attr) + (Attribute_has_no_sibling "left") + ) + method get_next_sibling = + new o_mDOMAttr + (option_to_exception + (Minidom.attr_get_next_sibling attr) + (Attribute_has_no_sibling "right") + ) + method get_parent = + new o_mDOMNode + (option_to_exception + (Minidom.attr_get_parent attr) Attribute_has_no_parent + ) + end +;; + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ominidom.mli b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ominidom.mli new file mode 100644 index 000000000..24329544d --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/ominidom.mli @@ -0,0 +1,64 @@ +exception Node_has_no_parent +exception Node_has_no_sibling of string +exception Node_has_no_children +exception Node_has_no_attributes +exception Attribute_has_no_sibling of string +exception Attribute_has_no_parent +exception Undefined_entity + +class o_mDOMString : Minidom.mDOMString -> + object + method get_dom_string : Minidom.mDOMString + method get_string : string + end + +val o_mDOMString_of_string : string -> o_mDOMString + +class o_mDOMEntity : Minidom.mDOMEntity -> + object + method get_content : o_mDOMString + method get_dom_entity : Minidom.mDOMEntity + end + +class o_mDOMDoc : Minidom.mDOMDoc -> + object + method add_entity : o_mDOMString -> o_mDOMString -> o_mDOMEntity + method get_dom_doc : Minidom.mDOMDoc + method get_entity : o_mDOMString -> o_mDOMEntity + method get_predefined_entity : o_mDOMString -> o_mDOMEntity + method get_root_node : o_mDOMNode + end +and o_mDOMNode : Minidom.mDOMNode -> + object + method get_attribute : o_mDOMString -> o_mDOMString option + method get_attribute_ns : + o_mDOMString -> o_mDOMString -> o_mDOMString option + method get_attributes : o_mDOMAttr list + method get_children : o_mDOMNode list + method get_content : o_mDOMString option + method get_dom_node : Minidom.mDOMNode + method get_first_attribute : o_mDOMAttr + method get_first_child : o_mDOMNode + method get_name : o_mDOMString option + method get_next_sibling : o_mDOMNode + method get_ns_uri : o_mDOMString option + method get_parent : o_mDOMNode + method get_prev_sibling : o_mDOMNode + method get_type : int + method is_blank : bool + method is_element : bool + method is_entity_ref : bool + method is_first : bool + method is_last : bool + method is_text : bool + end +and o_mDOMAttr : Minidom.mDOMAttr -> + object + method get_dom_attr : Minidom.mDOMAttr + method get_name : o_mDOMString option + method get_next_sibling : o_mDOMAttr + method get_ns_uri : o_mDOMString option + method get_parent : o_mDOMNode + method get_prev_sibling : o_mDOMAttr + method get_value : o_mDOMString option + end diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/test.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/test.ml new file mode 100644 index 000000000..3c7a092e9 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/test.ml @@ -0,0 +1,84 @@ + +let doc = Minidom.doc_load "test.xml" + +let root = Minidom.doc_get_root_node doc + +let check_attribute_ns attr = + Printf.printf "\n\n"; + let ns_uri = Minidom.attr_get_ns_uri attr + and attr_name = Minidom.attr_get_name attr + and attr_value = Minidom.attr_get_value attr + and parent = Minidom.attr_get_parent attr + in + match parent,ns_uri,attr_name,attr_value with + Some parent_node,Some uri,Some attribute_name,Some attribute_value -> + let attr_value = Minidom.node_get_attribute_ns parent_node attribute_name uri + in begin + match attr_value with + Some attr1 -> + Printf.printf "found the attribute with ns %s (was %s)\n" + (Minidom.string_of_mDOMString attr1) (Minidom.string_of_mDOMString attribute_value) + | None -> + Printf.printf "attribute not found (uri was %s)!!!!\n" (Minidom.string_of_mDOMString uri) + end + | _ -> + Printf.printf "parent_node == NULL || uri == NULL || attribute_name == NULL || attribute_value == NULL\n" +;; + +let print_attribute attr = + check_attribute_ns attr; + let ns_uri = Minidom.attr_get_ns_uri attr + in + begin + match ns_uri with + Some uri -> Printf.printf " %s:" (Minidom.string_of_mDOMString uri); + | None -> () + end; + match ((Minidom.attr_get_name attr), (Minidom.attr_get_value attr)) with + (Some attr_name, Some attr_value) -> + Printf.printf " %s=\"%s\"" (Minidom.string_of_mDOMString attr_name) (Minidom.string_of_mDOMString attr_value) + | (Some attr_name, _) -> + Printf.printf " ??? attribute %s has no value !!!" (Minidom.string_of_mDOMString attr_name) + | (_,_) -> + Printf.printf " ??? very strange attribute !!!" +;; + +let rec print_node n node = + if Minidom.node_is_blank node then () + else if Minidom.node_is_element node then begin + match Minidom.node_get_name node with + Some node_name -> + begin + let children = Minidom.node_get_children node + and attributes = Minidom.node_get_attributes node + and ns_uri = Minidom.node_get_ns_uri node + and is_first,is_last = (Minidom.node_is_first node), (Minidom.node_is_last node) + in + for i = 1 to n do print_char ' ' done; + Printf.printf "<"; + begin + match ns_uri with + Some uri -> Printf.printf "%s:" (Minidom.string_of_mDOMString uri) + | None -> () + end; + Printf.printf "%s" (Minidom.string_of_mDOMString node_name); + List.iter print_attribute attributes; + Printf.printf ">\n"; + List.iter (print_node (n + 2)) children; + for i = 1 to n do print_char ' ' done; + Printf.printf "\n" (Minidom.string_of_mDOMString node_name) + end + | None -> Printf.printf "??? this node has no name !!!\n" + end else if Minidom.node_is_text node then begin + match Minidom.node_get_content node with + Some node_content -> + for i = 1 to n do print_char ' ' done; + Printf.printf "%s\n" (Minidom.string_of_mDOMString node_content) + | None -> Printf.printf "??? this node has no content !!!\n" + end else begin + Printf.printf "don't know how to manage a node with type %d\n" (Minidom.node_get_type node) + end +;; + +print_node 0 root;; + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/test.xml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/test.xml new file mode 100644 index 000000000..83d2eef68 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/minidom/test.xml @@ -0,0 +1,505 @@ + + + + + + + + DEFINITION and_ind() OF TYPE + + + + + + + + __ + + + + + + + + ( + + + + + Π + A + : + + Prop + + + + + + + . + + + + + Π + B + : + + Prop + + + + + + + . + + + + + Π + P + : + + Prop + + + + + + + . + + + + + Π + f + : + + ( + A + + + ( + B + + P + ) + + ) + + + + + + + . + + Π + a + : + + ( + and + + _ + + A + + _ + + B + ) + + . + P + + + + + + + + + + + + + + + + + + + + + + + + + + + + :> + + Prop + + + + + + + + ) + + + + + + + + cast + + prod + + A + + + Prop + + + + + prod + + B + + + Prop + + + + + prod + + P + + + Prop + + + + + prod + + f + + + arrow + A + + arrow + B + P + + + + + + prod + + a + + + app + and + A + B + + + + P + + + + + + + Prop + + + + + + + + + + + AS + + + + + + + + __ + + + + + + + λ + A + : + + Prop + + + + + + + . + + + + + λ + B + : + + Prop + + + + + + + . + + + + + λ + P + : + + Prop + + + + + + + . + + + + + λ + f + : + + ( + A + + + ( + B + + P + ) + + ) + + + + + + + . + + + + + λ + a + : + + ( + and + + _ + + A + + _ + + B + ) + + + + + + + . + + < + P + > + CASES + + _ + + a + + _ + + OF + + ( + conj + + _ + + $1 + + _ + + $2 + ) + + + + ( + f + + _ + + $1 + + _ + + $2 + ) + + + _ + + END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A + + + Prop + + + + + + B + + + Prop + + + + + + P + + + Prop + + + + + + f + + + arrow + A + + arrow + B + P + + + + + + + a + + + app + and + A + B + + + + + mutcase + P + a + + app + conj + $1 + $2 + + + app + f + $1 + $2 + + + + + + + + + + + + + + diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/ml_gtk_mathview.c b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/ml_gtk_mathview.c new file mode 100644 index 000000000..3c86f0057 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/ml_gtk_mathview.c @@ -0,0 +1,159 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include "minidom/ml_minidom.h" + +/* : 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) + +#define FontManagerId_val(val) Int_val(val) +#define Val_FontManagerId(val) Val_int(val) + +FontManagerId +font_manager_id_of_value(value v) +{ + if (v == hash_variant("font_manager_gtk")) return FONT_MANAGER_GTK; + else if (v == hash_variant("font_manager_t1")) return FONT_MANAGER_T1; + else assert(0); +} + +value +value_of_font_manager_id(FontManagerId id) +{ + switch (id) { + case FONT_MANAGER_GTK: + return hash_variant("font_manager_gtk"); + case FONT_MANAGER_T1: + return hash_variant("font_manager_t1"); + default: + assert(0); + break; + } +} + +ML_2 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_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_mDOMNodeRef) +ML_2 (gtk_math_view_set_selection, GtkMathView_val, mDOMNodeRef_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) +ML_2 (gtk_math_view_set_font_manager_type, GtkMathView_val, font_manager_id_of_value, Unit) +ML_1 (gtk_math_view_get_font_manager_type, GtkMathView_val, value_of_font_manager_id) + +value +ml_gtk_math_view_export_to_postscript_native(value arg1, + value w, value h, value x0, value y0, value disable_colors, value arg2) +{ + CAMLparam5(arg1,w,h,x0,y0); + CAMLxparam2(disable_colors, arg2); + + char *filename; + FILE *fd; + int res; + filename = String_val (arg2); + if ((fd = fopen(filename, "w"))) { + gtk_math_view_export_to_postscript(GtkMathView_val (arg1), + Int_val(w), Int_val(h), Int_val(x0), Int_val(y0), Bool_val(disable_colors), 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_export_to_postscript_bytecode (value* arg, int argn) +{ + return ml_gtk_math_view_export_to_postscript_native(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6]); +} + +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; + CAMLlocal1 (tmp); + CAMLlocal1 (optval); + CAMLlocal1 (res); + + if (arg1==Val_int(0)) { + assert(0); + } else { + tmp = Field(arg1, 0); + nr = (mDOMNodeRef) Field(tmp, 1); + } + optval = Val_mDOMNodeRef(nr); + if (optval==Val_int(0)) { + assert(0); + } else { + res = Field(optval, 0); + } + + CAMLreturn(res); +} + +value ml_gtk_math_view_mDOMNode_option_of_bodex_option (value arg1) +{ + CAMLparam1(arg1); + + mDOMNodeRef nr; + CAMLlocal1 (tmp); + + if (arg1==Val_int(0)) { + nr=NULL; + } else { + tmp = Field(arg1, 0); + nr = (mDOMNodeRef) Field(tmp, 1); + } + + CAMLreturn(Val_mDOMNodeRef(nr)); +} diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/.cvsignore b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/.cvsignore new file mode 100644 index 000000000..1968614b7 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/.cvsignore @@ -0,0 +1 @@ +*.cmo *.cmi *.cmx t1lib.log test test.opt test.ps test.o diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/Makefile b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/Makefile new file mode 100644 index 000000000..d631d239f --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/Makefile @@ -0,0 +1,45 @@ +LABLGTK_DIR = /usr/lib/ocaml/lablgtk +LABLGTK_MATHVIEW_DIR = .. +MINIDOM_DIR = ../minidom +OCAMLC = ocamlc -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) \ + -I $(MINIDOM_DIR) -I mlmathview +OCAMLOPT = ocamlopt -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) \ + -I $(MINIDOM_DIR) -I mlmathview + +all: test +opt: test.opt + +test: test.cmo + $(OCAMLC) -custom -o test lablgtk.cma gtkInit.cmo \ + $(MINIDOM_DIR)/minidom.cmo \ + $(MINIDOM_DIR)/ominidom.cmo \ + $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cma \ + -cclib "$(MINIDOM_DIR)/ml_minidom.o" \ + test.cmo \ + -cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \ + -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \ + -L/usr/local/lib/gtkmathview -lgtkmathview \ + $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o" + +test.opt: test.cmx + $(OCAMLOPT) -o test.opt lablgtk.cmxa gtkInit.cmx \ + $(MINIDOM_DIR)/minidom.cmx \ + $(MINIDOM_DIR)/ominidom.cmx \ + $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cmxa \ + -cclib "$(MINIDOM_DIR)/ml_minidom.o" \ + test.cmx \ + -cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \ + -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \ + -L/usr/local/lib/gtkmathview -lgtkmathview \ + $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o" + +.SUFFIXES: .ml .mli .cmo .cmi .cmx +.ml.cmo: + $(OCAMLC) -c $< +.mli.cmi: + $(OCAMLC) -c $< +.ml.cmx: + $(OCAMLOPT) -c $< + +clean: + rm -f *.cm[iox] *.o test test.opt t1lib.log test.ps diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/t1.config b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/t1.config new file mode 100644 index 000000000..afb669e95 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/t1.config @@ -0,0 +1,3 @@ +ENCODING=. +AFM=/usr/share/texmf/fonts/afm/ +TYPE1=/usr/share/texmf/fonts/type1/bluesky/cm/:/usr/X11R6/lib/X11/fonts/Type1/:. diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/test.ml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/test.ml new file mode 100644 index 000000000..dd66d3885 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/test.ml @@ -0,0 +1,297 @@ +(******************************************************************************) +(* Claudio Sacerdoti Coen *) +(* 25/09/2000 *) +(* *) +(* This is a simple test for the OCaml (LablGtk indeed) binding of the *) +(* MathView widget *) +(******************************************************************************) + +(* Callbacks *) +let jump (node : Ominidom.o_mDOMNode) = + let module O = Ominidom in + print_string ("jump: " ^ + (match node#get_attribute (O.o_mDOMString_of_string "href") with + | Some x -> x#get_string + | None -> "NO HREF FOR THIS NODE" + ) ^ "\n"); + flush stdout +;; + +let selection_changed mathview (node : Ominidom.o_mDOMNode option) = + let module O = Ominidom in + print_string ("selection_changed: " ^ + (match node with + None -> "selection_changed on nothing" + | Some node -> + match node#get_name with + | Some x -> x#get_string + | None -> "on element without name" + ) ^ "\n"); + mathview#set_selection node; + flush stdout +;; + + +let clicked (node : Ominidom.o_mDOMNode) = + let module O = Ominidom in + print_string ("clicked: " ^ + (match node#get_name with + | Some x -> x#get_string + | None -> "no name" + ) ^ "\n"); + flush stdout +;; + + +let activate_t1 mathview () = + mathview#set_font_manager_type `font_manager_t1; + print_string "WIDGET SET WITH T1 FONTS\n" ; + flush stdout +;; + +let activate_gtk mathview () = + mathview#set_font_manager_type `font_manager_gtk; + print_string "WIDGET SET WITH GTK FONTS\n" ; + flush stdout +;; + +let get_font_manager_type mathview () = + print_string "CURRENT FONT MANAGER TYPE: "; + begin + match mathview#get_font_manager_type with + | `font_manager_t1 -> print_string "T1" + | `font_manager_gtk -> print_string "GTK" + end; + print_newline(); + flush stdout +;; + +let load mathview () = + mathview#load "test.xml" ; + print_string "load: SEEMS TO WORK\n" ; + flush stdout +;; + +let get_selection mathview () = + let module O = Ominidom in + let selection = + match mathview#get_selection with + | Some node -> + begin + match node#get_name with + | Some name -> name#get_string + | None -> "element with no name!" + end + | None -> "no selection!" + in + print_string ("get_selection: " ^ selection ^ "\n") ; + flush stdout +;; + +let set_selection mathview () = + let module O = Ominidom in + begin + match mathview#get_selection with + | Some node -> + begin + try + let parent_node = node#get_parent in + mathview#set_selection (Some parent_node); + print_string "set selection: SEEMS TO WORK\n" + with + _ -> print_string "EXCEPTION: no parent\n" + end + | None -> + mathview#set_selection None; + print_string "no selection\n" + end ; + flush stdout +;; + +let unload mathview () = + mathview#unload ; + print_string "unload: SEEMS TO WORK\n" ; + flush stdout +;; + +let get_width mathview () = + print_string ("get_width: " ^ string_of_int (mathview#get_width) ^ "\n") ; + flush stdout +;; + +let get_height mathview () = + print_string ("get_height: " ^ string_of_int (mathview#get_height) ^ "\n") ; + flush stdout +;; + +let get_top mathview () = + let (x,y) = mathview#get_top in + print_string ("get_top: ("^ string_of_int x ^ "," ^ string_of_int y ^ ")\n") ; + flush stdout +;; + +let set_top mathview () = + mathview#set_top 0 0; + print_string "set_top: SEEM TO WORK\n" ; + flush stdout +;; + +let set_adjustments mathview () = + let adj1 = GData.adjustment () in + let adj2 = GData.adjustment () in + mathview#set_adjustments adj1 adj2 ; + adj1#set_value ((adj1#lower +. adj1#upper) /. 2.0) ; + adj2#set_value ((adj2#lower +. adj2#upper) /. 2.0) ; + print_string "set_adjustments: SEEM TO WORK\n" ; + flush stdout +;; + +let get_hadjustment mathview () = + let adj = mathview#get_hadjustment in + adj#set_value ((adj#lower +. adj#upper) /. 2.0) ; + print_string "get_hadjustment: SEEM TO WORK\n" ; + flush stdout +;; + +let get_vadjustment mathview () = + let adj = mathview#get_vadjustment in + adj#set_value ((adj#lower +. adj#upper) /. 2.0) ; + print_string "get_vadjustment: SEEM TO WORK\n" ; + flush stdout +;; + +let get_buffer mathview () = + let buffer = mathview#get_buffer in + Gdk.Draw.rectangle buffer (Gdk.GC.create buffer) ~x:0 ~y:0 + ~width:50 ~height:50 ~filled:true () ; + print_string "get_buffer: SEEMS TO WORK (hint: force the widget redrawing)\n"; + flush stdout +;; + +let get_frame mathview () = + let frame = mathview#get_frame in + frame#set_shadow_type `NONE ; + print_string "get_frame: SEEMS TO WORK\n" ; + flush stdout +;; + +let set_font_size mathview () = + mathview#set_font_size 24 ; + print_string "set_font_size: FONT IS NOW 24\n" ; + flush stdout +;; + +let get_font_size mathview () = + print_string ("get_font_size: " ^ string_of_int (mathview#get_font_size) ^ "\n") ; + flush stdout +;; + +let set_anti_aliasing mathview () = + mathview#set_anti_aliasing true ; + print_string "set_anti_aliasing: ON\n" ; + flush stdout +;; + +let get_anti_aliasing mathview () = + print_string ("get_anti_aliasing: " ^ + (match mathview#get_anti_aliasing with true -> "ON" | false -> "OFF") ^ + "\n") ; + flush stdout +;; + +let set_kerning mathview () = + mathview#set_kerning true ; + print_string "set_kerning: ON\n" ; + flush stdout +;; + +let get_kerning mathview () = + print_string ("get_kerning: " ^ + (match mathview#get_kerning with true -> "ON" | false -> "OFF") ^ + "\n") ; + flush stdout +;; + +let set_log_verbosity mathview () = + mathview#set_log_verbosity 3 ; + print_string "set_log_verbosity: NOW IS 3\n" ; + flush stdout +;; + +let get_log_verbosity mathview () = + print_string ("get_log_verbosity: " ^ + string_of_int mathview#get_log_verbosity ^ + "\n") ; + flush stdout +;; + +let export_to_postscript (mathview : GMathView.math_view) () = + mathview#export_to_postscript ~filename:"test.ps" (); + print_string "expor_to_postscript: SEEMS TO WORK (hint: look at test.ps)\n"; + flush stdout +;; + +(* Widget creation *) +let main_window = GWindow.window ~title:"GtkMathView test" () in +let vbox = GPack.vbox ~packing:main_window#add () in +let sw = GBin.scrolled_window ~width:50 ~height:50 ~packing:vbox#pack () in +let mathview= GMathView.math_view ~packing:sw#add ~width:50 ~height:50 () in +let table = GPack.table ~rows:6 ~columns:5 ~packing:vbox#pack () in +let button_gtk=GButton.button ~label:"activate Gtk fonts" ~packing:(table#attach ~left:0 ~top:0) () in +let button_load = GButton.button ~label:"load" ~packing:(table#attach ~left:1 ~top:0) () in +let button_unload = GButton.button ~label:"unload" ~packing:(table#attach ~left:2 ~top:0) () in +let button_get_selection = GButton.button ~label:"get_selection" ~packing:(table#attach ~left:3 ~top:0) () in +let button_set_selection = GButton.button ~label:"set_selection" ~packing:(table#attach ~left:4 ~top:0) () in +let button_get_width = GButton.button ~label:"get_width" ~packing:(table#attach ~left:0 ~top:1) () in +let button_get_height = GButton.button ~label:"get_height" ~packing:(table#attach ~left:1 ~top:1) () in +let button_get_top = GButton.button ~label:"get_top" ~packing:(table#attach ~left:2 ~top:1) () in +let button_set_top = GButton.button ~label:"set_top" ~packing:(table#attach ~left:3 ~top:1) () in +let button_set_adjustments = GButton.button ~label:"set_adjustments" ~packing:(table#attach ~left:4 ~top:1) () in +let button_get_hadjustment = GButton.button ~label:"get_hadjustment" ~packing:(table#attach ~left:0 ~top:2) () in +let button_get_vadjustment = GButton.button ~label:"get_vadjustment" ~packing:(table#attach ~left:1 ~top:2) () in +let button_get_buffer = GButton.button ~label:"get_buffer" ~packing:(table#attach ~left:2 ~top:2) () in +let button_get_frame = GButton.button ~label:"get_frame" ~packing:(table#attach ~left:3 ~top:2) () in +let button_set_font_size = GButton.button ~label:"set_font_size" ~packing:(table#attach ~left:4 ~top:2) () in +let button_get_font_size = GButton.button ~label:"get_font_size" ~packing:(table#attach ~left:0 ~top:3) () in +let button_set_anti_aliasing = GButton.button ~label:"set_anti_aliasing" ~packing:(table#attach ~left:1 ~top:3) () in +let button_get_anti_aliasing = GButton.button ~label:"get_anti_aliasing" ~packing:(table#attach ~left:2 ~top:3) () in +let button_set_kerning = GButton.button ~label:"set_kerning" ~packing:(table#attach ~left:3 ~top:3) () in +let button_get_kerning = GButton.button ~label:"get_kerning" ~packing:(table#attach ~left:4 ~top:3) () in +let button_set_log_verbosity = GButton.button ~label:"set_log_verbosity" ~packing:(table#attach ~left:0 ~top:4) () in +let button_get_log_verbosity = GButton.button ~label:"get_log_verbosity" ~packing:(table#attach ~left:1 ~top:4) () in +let button_export_to_postscript = GButton.button ~label:"export_to_postscript" ~packing:(table#attach ~left:2 ~top:4) () in +let button_t1 = GButton.button ~label:"activate T1 fonts" ~packing:(table#attach ~left:3 ~top:4) () in +let button_get_font_manager_type = GButton.button ~label:"get_font_manager" ~packing:(table#attach ~left:4 ~top:4) () in +(* Signals connection *) +ignore(button_gtk#connect#clicked (activate_gtk mathview)) ; +ignore(button_load#connect#clicked (load mathview)) ; +ignore(button_unload#connect#clicked (unload mathview)) ; +ignore(button_get_selection#connect#clicked (get_selection mathview)) ; +ignore(button_set_selection#connect#clicked (set_selection mathview)) ; +ignore(button_get_width#connect#clicked (get_width mathview)) ; +ignore(button_get_height#connect#clicked (get_height mathview)) ; +ignore(button_get_top#connect#clicked (get_top mathview)) ; +ignore(button_set_top#connect#clicked (set_top mathview)) ; +ignore(button_set_adjustments#connect#clicked (set_adjustments mathview)) ; +ignore(button_get_hadjustment#connect#clicked (get_hadjustment mathview)) ; +ignore(button_get_vadjustment#connect#clicked (get_vadjustment mathview)) ; +ignore(button_get_buffer#connect#clicked (get_buffer mathview)) ; +ignore(button_get_frame#connect#clicked (get_frame mathview)) ; +ignore(button_set_font_size#connect#clicked (set_font_size mathview)) ; +ignore(button_get_font_size#connect#clicked (get_font_size mathview)) ; +ignore(button_set_anti_aliasing#connect#clicked (set_anti_aliasing mathview)) ; +ignore(button_get_anti_aliasing#connect#clicked (get_anti_aliasing mathview)) ; +ignore(button_set_kerning#connect#clicked (set_kerning mathview)) ; +ignore(button_get_kerning#connect#clicked (get_kerning mathview)) ; +ignore(button_set_log_verbosity#connect#clicked (set_log_verbosity mathview)) ; +ignore(button_get_log_verbosity#connect#clicked (get_log_verbosity mathview)) ; +ignore(button_export_to_postscript#connect#clicked (export_to_postscript mathview)) ; +ignore(button_t1#connect#clicked (activate_t1 mathview)) ; +ignore(button_get_font_manager_type#connect#clicked (get_font_manager_type mathview)) ; +ignore(mathview#connect#jump jump) ; +ignore(mathview#connect#clicked clicked) ; +ignore(mathview#connect#selection_changed (selection_changed mathview)) ; +(* Main Loop *) +main_window#show () ; +GMain.Main.main () +;; diff --git a/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/test.xml b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/test.xml new file mode 100644 index 000000000..b0f8c1563 --- /dev/null +++ b/helm/DEVEL/lablgtk_gtkmathview/lablgtk-20001129_gtkmathview-0.2.1/test/test.xml @@ -0,0 +1,123 @@ + + + + + + + + a + + x + + + + b + + + + x + 2 + + + + + p + + x + + + + q + + + + d + x + = + + + a2 + + + ln + + + ( + + x2 + + + + p + + x + + + + q + + ) + + + + + + + + + + 2 + + b + + - + + a + + p + + + + + + 4 + + q + + - + + p + 2 + + + + + + + arctg + + + + + 2 + + x + + + + p + + + + + 4 + + q + + - + + p + 2 + + + + + + + + + c + + diff --git a/helm/DEVEL/lablgtkmathview/.cvsignore b/helm/DEVEL/lablgtkmathview/.cvsignore new file mode 100644 index 000000000..930b7a63e --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/.cvsignore @@ -0,0 +1 @@ +*.cmi *.cmo *.cmx *.cma *.cmxa config.make config.cache config.log configure diff --git a/helm/DEVEL/lablgtkmathview/.depend b/helm/DEVEL/lablgtkmathview/.depend new file mode 100644 index 000000000..600449bb8 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/.depend @@ -0,0 +1,4 @@ +gMathView.cmo: gtkMathView.cmo gtk_mathview.cmo +gMathView.cmx: gtkMathView.cmx gtk_mathview.cmx +gtkMathView.cmo: gtk_mathview.cmo +gtkMathView.cmx: gtk_mathview.cmx diff --git a/helm/DEVEL/lablgtkmathview/AUTHORS b/helm/DEVEL/lablgtkmathview/AUTHORS new file mode 100644 index 000000000..3598094a9 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/AUTHORS @@ -0,0 +1,2 @@ +Luca Padovani +Claudio Sacerdoti Coen diff --git a/helm/DEVEL/lablgtkmathview/COPYING b/helm/DEVEL/lablgtkmathview/COPYING new file mode 100644 index 000000000..d60c31a97 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/helm/DEVEL/lablgtkmathview/ChangeLog b/helm/DEVEL/lablgtkmathview/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/helm/DEVEL/lablgtkmathview/LICENSE b/helm/DEVEL/lablgtkmathview/LICENSE new file mode 100644 index 000000000..3781bdacc --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/LICENSE @@ -0,0 +1,21 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of lablgtkmathview, the Ocaml binding + * for the GtkMathView widget. + * + * lablgtkmathview is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * lablgtkmathview 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with lablgtkmathview; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) diff --git a/helm/DEVEL/lablgtkmathview/Makefile.in b/helm/DEVEL/lablgtkmathview/Makefile.in new file mode 100644 index 000000000..7dfbb1e16 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/Makefile.in @@ -0,0 +1,118 @@ +# Makefile for lablgtk_mathview. + +VERSION = @LABLGTKMATHVIEW_VERSION@ +LABLGTKDIR = @LABLGTK_LIB_DIR@ +MLMINIDOMDIR = @MLMINIDOM_LIB_DIR@ +TESTDIR = ./test +MLFLAGS += -I $(LABLGTKDIR) -I $(MLMINIDOMDIR) + +DIST_FILES = \ + AUTHORS COPYING ChangeLog LICENSE Makefile.in NEWS README configure \ + configure.in configure.mk gMathView.ml gtkMathView.ml gtk_mathview.ml \ + ml_gtk_mathview.c + +TARGETS = ml_gtk_mathview.o lablgtkmathview.cma + +all: $(TARGETS) + +opt: lablgtkmathviewopt + +dist: + rm -rf lablgtkmathview-$(VERSION) + mkdir lablgtkmathview-$(VERSION) + cp $(DIST_FILES) lablgtkmathview-$(VERSION) + tar cvfz lablgtkmathview-$(VERSION).tar.gz lablgtkmathview-$(VERSION) + rm -rf lablgtkmathview-$(VERSION) + +configure: + @rm -f config.make + @$(MAKE) --no-print-directory -f configure.mk + +depend: + @rm -f .depend + @$(MAKE) --no-print-directory -f configure.mk .depend + +.depend config.make: + @$(MAKE) --no-print-directory -f configure.mk + +COMPILER = $(CAMLC) $(MLFLAGS) -w s -labels -c +LINKER = $(CAMLC) $(MLFLAGS) +COMPOPT = $(CAMLOPT) $(MLFLAGS) -w s -labels -c +LINKOPT = $(CAMLOPT) $(MLFLAGS) + +include config.make + +INSTALLDIR = $(LIBDIR)/lablgtkmathview + +MLLIBS = lablgtkmathview.cma +CLIBS = +MLLINK = unix.cma str.cma + +ifdef DEBUG +CFLAGS = -g $(GTKCFLAGS) +MLLINK += -cclib -lcamlrund +MLFLAGS += -g +else +CFLAGS = -O -DGTK_NO_CHECK_CASTS -DGTK_DISABLE_COMPAT_H $(GTKCFLAGS) +endif +CFLAGS += $(MINIDOMCFLAGS) $(GTKMATHVIEWCFLAGS) + +THFLAGS = -thread +THLINK = unix.cma threads.cma + +ifdef USE_CC +CCOMPILER = $(CC) -c -I$(LIBDIR) $(CFLAGS) +else +CCOMPILER = ocamlc -c -ccopt "$(CFLAGS)" +endif + +# Rules +.SUFFIXES: .ml .mli .cmo .cmi .cmx .c .o .var .h .opt .def +.c.o: + $(CCOMPILER) $< +.ml.cmo: + $(COMPILER) $< +.mli.cmi: + $(COMPILER) $< +.ml.cmx: + $(COMPOPT) $< +.var.h: + ./var2def < $< > $@ +.var.c: + ./var2conv < $< > $@ + +# Targets +COBJS = ml_gtk_mathview.o +MLOBJS = gtk_mathview.cmo gtkMathView.cmo gMathView.cmo +ALLOBJS = $(MLOBJS) + +lablgtkmathviewopt: $(CLIBS) $(MLLIBS:.cma=.cmxa) + +install: + if test -d $(INSTALLDIR); then : ; else mkdir -p $(INSTALLDIR); fi + cp $(ALLOBJS:.cmo=.cmi) $(INSTALLDIR) + if test -f *.mli ; then cp *.mli $(INSTALLDIR) ; fi + cp $(ALLOBJS:.cmo=.ml) $(INSTALLDIR) + cp $(MLLIBS) $(INSTALLDIR) + cp $(COBJS) $(INSTALLDIR) + if test ! -z "$(CLIBS)" ; then cp $(CLIBS) $(INSTALLDIR) ; fi + if test -f lablgtkmathview.cmxa; then \ + cp $(MLLIBS:.cma=.cmxa) $(MLLIBS:.cma=.a) \ + $(INSTALLDIR); fi + +lablgtkmathview.cma: $(MLOBJS) + $(LINKER) -a -custom -o $@ $(MLOBJS) $(GTKLIBS) -cclib "$(GTKMATHVIEWLIBS)" -cclib "$(MINIDOMLIBS)" +lablgtkmathview.cmxa: $(MLOBJS:.cmo=.cmx) + $(LINKOPT) -a -o $@ $(MLOBJS:.cmo=.cmx) $(GTKLIBS) -cclib "$(GTKMATHVIEWLIBS)" -cclib "$(MINIDOMLIBS)" + +ml_gtk.o: $(LABLGTKDIR)/gtk_tags.c $(LABLGTKDIR)/gtk_tags.h \ + $(LABLGTKDIR)/ml_gtk.h $(LABLGTKDIR)/ml_gdk.h $(LABLGTKDIR)/wrappers.h + +clean: + rm -f *.cm* *.o *.a *_tags.[ch] $(TARGETS) + cd $(TESTDIR); make clean + +distclean: clean + rm -f configure config.cache config.status config.log Makefile + +include .depend diff --git a/helm/DEVEL/lablgtkmathview/NEWS b/helm/DEVEL/lablgtkmathview/NEWS new file mode 100644 index 000000000..e69de29bb diff --git a/helm/DEVEL/lablgtkmathview/README b/helm/DEVEL/lablgtkmathview/README new file mode 100644 index 000000000..61c34d46e --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/README @@ -0,0 +1,9 @@ +This is the Ocaml binding for the GtkMathView widget. + +To compile and install: + + ./configure + make + make opt + make install + diff --git a/helm/DEVEL/lablgtkmathview/configure.in b/helm/DEVEL/lablgtkmathview/configure.in new file mode 100644 index 000000000..c1403adea --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/configure.in @@ -0,0 +1,67 @@ +AC_INIT(gMathView.ml) + +LABLGTKMATHVIEW_MAJOR_VERSION=0 +LABLGTKMATHVIEW_MINOR_VERSION=2 +LABLGTKMATHVIEW_MICRO_VERSION=2 +LABLGTKMATHVIEW_VERSION=$LABLGTKMATHVIEW_MAJOR_VERSION.$LABLGTKMATHVIEW_MINOR_VERSION.$LABLGTKMATHVIEW_MICRO_VERSION + +AC_CHECK_PROG(HAVE_GTKMATHVIEW, gtkmathview-config, yes, no) +if test $HAVE_GTKMATHVIEW = "no"; then + AC_MSG_ERROR(could not find gtkmathview configuration script, please make sure gtkmathview is installed) +fi + +AC_CHECK_PROG(HAVE_OCAMLC, ocamlc, yes, no) +if test $HAVE_OCAMLC = "no"; then + AC_MSG_ERROR(could not find ocamlc in PATH, please make sure ocaml is installed) +fi + +AC_MSG_CHECKING(for the ocaml library dir) +OCAML_ROOT=`ocamlc -v | grep "^Standard" | sed 's/^.*: *//'` +AC_MSG_RESULT($OCAML_ROOT) + +RES="yes" +AC_CHECK_FILE($OCAML_ROOT/lablgtk/gtk.ml, + LABLGTK_LIB_DIR=$OCAML_ROOT/lablgtk, + RES="no" +) + +if test $RES = "no"; then + RES="" + AC_CACHE_VAL(lablgtkmathview_cv_LABLGTK_LIB_DIR, + echo "In which directory can I find the lablgtk library? (I haven't found it in the usual location $OCAML_ROOT/lablgtk)" + read lablgtkmathview_cv_LABLGTK_LIB_DIR + RES="Asked" + ) + LABLGTK_LIB_DIR=$lablgtkmathview_cv_LABLGTK_LIB_DIR + if test "$RES" != "Asked"; then + LABLGTK_LIB_DIR=`eval "echo $LABLGTK_LIB_DIR"` + fi + AC_CACHE_SAVE +fi + +RES="yes" +AC_CHECK_FILE($OCAML_ROOT/mlminidom/minidom.mli, + MLMINIDOM_LIB_DIR=$OCAML_ROOT/mlminidom, + RES="no" +) + +if test $RES = "no"; then + RES="" + AC_CACHE_VAL(lablgtkmathview_cv_MLMINIDOM_LIB_DIR, + echo "In which directory can I find the mlminidom library? (I haven't found it in the usual location $OCAML_ROOT/mlminidom)" + read lablgtkmathview_cv_MLMINIDOM_LIB_DIR + RES="Asked" + ) + MLMINIDOM_LIB_DIR=$lablgtkmathview_cv_MLMINIDOM_LIB_DIR + if test "$RES" != "Asked"; then + MLMINIDOM_LIB_DIR=`eval "echo $MLMINIDOM_LIB_DIR"` + fi + AC_CACHE_SAVE +fi + +AC_SUBST(LABLGTKMATHVIEW_VERSION) +AC_SUBST(OCAML_ROOT) +AC_SUBST(LABLGTK_LIB_DIR) +AC_SUBST(MLMINIDOM_LIB_DIR) + +AC_OUTPUT([Makefile]) diff --git a/helm/DEVEL/lablgtkmathview/configure.mk b/helm/DEVEL/lablgtkmathview/configure.mk new file mode 100644 index 000000000..ccfb7a619 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/configure.mk @@ -0,0 +1,59 @@ +# makefile for configuring lablGTK_mathview + +# Default compilers +CAMLC = ocamlc +CAMLOPT = ocamlopt + +# Default installation directories +BINDIR = `$(GETBINDIR)` +INSTALLDIR = $(LIBDIR)/lablgtkmathview + +# Autoconf +GETLIBDIR = ocamlc -v | grep "^Standard" | sed 's/^.*: *//' +LIBDIR = `$(GETLIBDIR)` +GETBINDIR = $(GETLIBDIR) | sed -e 's|/lib/[^/]*$$|/bin|' -e 's|/lib$$|/bin|' +GETRANLIB = which ranlib 2>/dev/null | sed -e 's|.*/ranlib$$|!|' -e 's/^[^!]*$$/:/' -e 's/!/ranlib/' + +ifdef USE_GNOME +GTKGETCFLAGS = gtk-config --cflags`" -I"`gnome-config --includedir +GNOMELIBS = `gnome-config --libs gtkxmhtml` +else +GTKGETCFLAGS = gtk-config --cflags +endif + +GTKGETLIBS = gtk-config --libs + +configure: .depend config.make + +.depend: + ocamldep *.ml *.mli > .depend + +config.make: + @echo CAMLC=$(CAMLC) > config.make + @echo CAMLOPT=$(CAMLOPT) >> config.make + @echo USE_GL=$(USE_GL) >> config.make + @echo USE_GNOME=$(USE_GNOME) >> config.make + @echo USE_CC=$(USE_CC) >> config.make + @echo DEBUG=$(DEBUG) >> config.make + @echo CC=$(CC) >> config.make + @echo RANLIB=`$(GETRANLIB)` >> config.make + @echo LIBDIR=$(LIBDIR) >> config.make + @echo BINDIR=`$(GETBINDIR)` >> config.make + @echo INSTALLDIR=$(INSTALLDIR) >> config.make +# Luca: was +# @echo GTKCFLAGS=`$(GTKGETCFLAGS)` -I/usr/lib/ocaml/lablgtk >> config.make +# Luca: now + @echo GTKCFLAGS=`$(GTKGETCFLAGS)` -I$(LIBDIR)/lablgtk >> config.make + @echo GTKLIBS=`$(GTKGETLIBS)` | \ + sed -e 's/-l/-cclib &/g' -e 's/-[LRWr][^ ]*/-ccopt &/g' \ + >> config.make +# Luca: GtkMathView configuration + @echo GTKMATHVIEWCFLAGS=`gtkmathview-config --cflags` >> config.make + @echo MINIDOMCFLAGS=`minidom-config --cflags` >> config.make + @echo GTKMATHVIEWLIBS=`gtkmathview-config --libs` >> config.make + @echo MINIDOMLIBS=`minidom-config --libs` >> config.make +# Luca: end of GtkMathView configuration + @echo GNOMELIBS=$(GNOMELIBS) | \ + sed -e 's/-l/-cclib &/g' -e 's/-[LRWr][^ ]*/-ccopt &/g' \ + >> config.make + cat config.make diff --git a/helm/DEVEL/lablgtkmathview/gMathView.ml b/helm/DEVEL/lablgtkmathview/gMathView.ml new file mode 100644 index 000000000..b937831f7 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/gMathView.ml @@ -0,0 +1,102 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of lablgtkmathview, the Ocaml binding + * for the GtkMathView widget. + * + * lablgtkmathview is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * lablgtkmathview 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with lablgtkmathview; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +open Gaux +open Gtk +open Gtk_mathview +open GtkBase +open GtkMathView +open GObj + +exception ErrorLoadingFile of string;; +exception ErrorWritingFile of string;; +exception NoSelection;; + +class math_view_signals obj = object + inherit GContainer.container_signals obj + method clicked = GtkSignal.connect ~sgn:MathView.Signals.clicked obj ~after + method jump = GtkSignal.connect ~sgn:MathView.Signals.jump obj ~after + method selection_changed = + GtkSignal.connect ~sgn:MathView.Signals.selection_changed obj ~after +end + +class math_view obj = object + inherit GContainer.container (obj : Gtk_mathview.math_view obj) + method connect = new math_view_signals obj + method load ~filename = + if not (MathView.load obj ~filename) then raise (ErrorLoadingFile filename) + method unload = MathView.unload obj + method get_selection = MathView.get_selection obj + method set_selection (node : Ominidom.o_mDOMNode option) = MathView.set_selection obj node + method get_width = MathView.get_width obj + method get_height = MathView.get_height obj + method get_top = MathView.get_top obj + method set_top = MathView.set_top obj + method set_adjustments = + fun adj1 adj2 -> + MathView.set_adjustments obj (GData.as_adjustment adj1) + (GData.as_adjustment adj2) + method get_hadjustment = new GData.adjustment (MathView.get_hadjustment obj) + method get_vadjustment = new GData.adjustment (MathView.get_vadjustment obj) + method get_buffer = MathView.get_buffer obj + method get_frame = new GBin.frame (MathView.get_frame obj) + method set_font_size = MathView.set_font_size obj + method get_font_size = MathView.get_font_size obj + method set_anti_aliasing = MathView.set_anti_aliasing obj + method get_anti_aliasing = MathView.get_anti_aliasing obj + method set_kerning = MathView.set_kerning obj + method get_kerning = MathView.get_kerning obj + method set_log_verbosity = MathView.set_log_verbosity obj + method get_log_verbosity = MathView.get_log_verbosity obj + method export_to_postscript + ?(width = 595) ?(height = 822) ?(x_margin = 72) ?(y_margin = 72) + ?(disable_colors = false) ~filename () = + let result = MathView.export_to_postscript obj + ~width ~height ~x_margin ~y_margin ~disable_colors ~filename + in + if not result then raise (ErrorWritingFile filename) + method get_font_manager_type = MathView.get_font_manager_type obj + method set_font_manager_type ~fm_type = MathView.set_font_manager_type obj ~fm_type +end + +let math_view ?adjustmenth ?adjustmentv ?font_size ?font_manager ?border_width + ?width ?height ?packing ?show () = + let w = + MathView.create + ?adjustmenth:(may_map ~f:GData.as_adjustment adjustmenth) + ?adjustmentv:(may_map ~f:GData.as_adjustment adjustmentv) + () + in + Container.set w ?border_width ?width ?height; + let mathview = pack_return (new math_view w) ~packing ~show in + begin + match font_size with + | Some size -> mathview#set_font_size size + | None -> () + end; + begin + match font_manager with + | Some manager -> mathview#set_font_manager_type ~fm_type:manager + | None -> () + end; + mathview +;; diff --git a/helm/DEVEL/lablgtkmathview/gtkMathView.ml b/helm/DEVEL/lablgtkmathview/gtkMathView.ml new file mode 100644 index 000000000..67a634a16 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/gtkMathView.ml @@ -0,0 +1,140 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of lablgtkmathview, the Ocaml binding + * for the GtkMathView widget. + * + * lablgtkmathview is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * lablgtkmathview 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with lablgtkmathview; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +open Gtk +open Gtk_mathview +open Tags +open GtkBase +open Gpointer + +external mDOMNode_of_boxed_option : + Gpointer.boxed option -> Minidom.mDOMNode = + "ml_gtk_math_view_mDOMNode_of_bodex_option" + +external mDOMNode_option_of_boxed_option : + Gpointer.boxed option -> Minidom.mDOMNode option = + "ml_gtk_math_view_mDOMNode_option_of_bodex_option" + +let o_mDOMNode_of_mDOMNode node = new Ominidom.o_mDOMNode node + +let o_mDOMNode_option_of_mDOMNode_option = + function + | Some x -> Some (o_mDOMNode_of_mDOMNode x) + | None -> None + +let mDOMNode_option_of_o_mDOMNode_option = + function + | Some x -> Some (x#get_dom_node) + | None -> None + +module MathView = struct + exception NoSelection + + let cast w : math_view obj = Object.try_cast w "GtkMathView" + external create : Gtk.adjustment optobj -> Gtk.adjustment optobj -> + math_view obj = "ml_gtk_math_view_new" + let create ~adjustmenth ~adjustmentv () = + create (optboxed adjustmenth) (optboxed adjustmentv) + external load : [>`math_view] obj -> filename:string -> bool = + "ml_gtk_math_view_load" + external unload : [>`math_view] obj -> unit = + "ml_gtk_math_view_unload" + external raw_get_selection : [>`math_view] obj -> Minidom.mDOMNode option = + "ml_gtk_math_view_get_selection" + let get_selection obj = + o_mDOMNode_option_of_mDOMNode_option (raw_get_selection obj) + external raw_set_selection : [>`math_view] obj -> Minidom.mDOMNode option -> unit= + "ml_gtk_math_view_set_selection" + let set_selection obj node = + raw_set_selection obj (mDOMNode_option_of_o_mDOMNode_option node) + external get_width : [>`math_view] obj -> int = + "ml_gtk_math_view_get_width" + external get_height : [>`math_view] obj -> int = + "ml_gtk_math_view_get_height" + external get_top : [>`math_view] obj -> (int * int) = + "ml_gtk_math_view_get_top" + external set_top : [>`math_view] obj -> int -> int -> unit = + "ml_gtk_math_view_set_top" + external set_adjustments : [>`math_view] obj -> Gtk.adjustment obj -> Gtk.adjustment obj -> unit = + "ml_gtk_math_view_set_adjustments" + external get_hadjustment : [>`math_view] obj -> Gtk.adjustment obj = + "ml_gtk_math_view_get_hadjustment" + external get_vadjustment : [>`math_view] obj -> Gtk.adjustment obj = + "ml_gtk_math_view_get_vadjustment" + external get_buffer : [>`math_view] obj -> Gdk.pixmap = + "ml_gtk_math_view_get_buffer" + external get_frame : [>`math_view] obj -> [`frame] obj = + "ml_gtk_math_view_get_frame" + external set_font_size : [>`math_view] obj -> int -> unit = + "ml_gtk_math_view_set_font_size" + external get_font_size : [>`math_view] obj -> int = + "ml_gtk_math_view_get_font_size" + external set_anti_aliasing : [>`math_view] obj -> bool -> unit = + "ml_gtk_math_view_set_anti_aliasing" + external get_anti_aliasing : [>`math_view] obj -> bool = + "ml_gtk_math_view_get_anti_aliasing" + external set_kerning : [>`math_view] obj -> bool -> unit = + "ml_gtk_math_view_set_kerning" + external get_kerning : [>`math_view] obj -> bool = + "ml_gtk_math_view_get_kerning" + external set_log_verbosity : [>`math_view] obj -> int -> unit = + "ml_gtk_math_view_set_log_verbosity" + external get_log_verbosity : [>`math_view] obj -> int = + "ml_gtk_math_view_get_log_verbosity" + external export_to_postscript : + [>`math_view] obj -> width:int -> height:int -> x_margin:int -> y_margin:int -> disable_colors:bool -> filename:string -> bool = + "ml_gtk_math_view_export_to_postscript_bytecode" "ml_gtk_math_view_export_to_postscript_native" + external get_font_manager_type : [>`math_view] obj -> + [`font_manager_gtk | `font_manager_t1] = + "ml_gtk_math_view_get_font_manager_type" + external set_font_manager_type : [>`math_view] obj -> + fm_type:[`font_manager_gtk | `font_manager_t1] -> unit = + "ml_gtk_math_view_set_font_manager_type" + + module Signals = struct + open GtkSignal + + let clicked : ([>`math_view],_) t = + let marshal_clicked f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_clicked" + in + { name = "clicked"; marshaller = marshal_clicked } + + let jump : ([>`math_view],_) t = + let marshal_jump f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_of_mDOMNode (mDOMNode_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_jump" + in + { name = "jump"; marshaller = marshal_jump } + + let selection_changed : ([>`math_view],_) t = + let marshal_selection_changed f _ = + function + [GtkArgv.POINTER node] -> f (o_mDOMNode_option_of_mDOMNode_option (mDOMNode_option_of_boxed_option node)) + | _ -> invalid_arg "GtkMathView.MathView.Signals.marshal_selection_changed" + in + { name = "selection_changed"; marshaller = marshal_selection_changed } + end +end diff --git a/helm/DEVEL/lablgtkmathview/gtk_mathview.ml b/helm/DEVEL/lablgtkmathview/gtk_mathview.ml new file mode 100644 index 000000000..a8ef3ea86 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/gtk_mathview.ml @@ -0,0 +1,23 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of lablgtkmathview, the Ocaml binding + * for the GtkMathView widget. + * + * lablgtkmathview is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * lablgtkmathview 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with lablgtkmathview; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +type math_view = [`widget|`container|`bin|`eventbox|`math_view] diff --git a/helm/DEVEL/lablgtkmathview/lablgtkmathview-0.2.2-1.spec b/helm/DEVEL/lablgtkmathview/lablgtkmathview-0.2.2-1.spec new file mode 100644 index 000000000..9bc18375c --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/lablgtkmathview-0.2.2-1.spec @@ -0,0 +1,28 @@ +Summary: The LablGTK binding for the GtkMathView widget +Name: lablgtkmathview +Version: 0.2.2 +Release: 1 +Copyright: GPL +URL: http://www.cs.unibo.it/helm +Packager: Luca Padovani +Requires: gtkmathview >= 0.2.2 ocaml >= 3.00 lablgtk_20001129, lablgtk-20001129_gtkmathview +Group: Applications/Publishing +Source: www.cs.unibo.it:/~lpadovan/mml-widget/lablgtkmathview-0.2.2.tar.gz +%description +The LablGTK binding for the GtkMathView widget + +%prep +%setup + +%build +./configure +make configure + +%install +make +make opt +make install + +%files +%doc AUTHORS COPYING ChangeLog NEWS README +/usr/lib/ocaml/lablgtkmathview diff --git a/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c b/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c new file mode 100644 index 000000000..bc7d13528 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/ml_gtk_mathview.c @@ -0,0 +1,181 @@ +/* Copyright (C) 2000, Luca Padovani . + * + * This file is part of lablgtkmathview, the Ocaml binding + * for the GtkMathView widget. + * + * lablgtkmathview is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * lablgtkmathview 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with lablgtkmathview; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include "minidom/ml_minidom.h" + +/* : 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) + +#define FontManagerId_val(val) Int_val(val) +#define Val_FontManagerId(val) Val_int(val) + +FontManagerId +font_manager_id_of_value(value v) +{ + if (v == hash_variant("font_manager_gtk")) return FONT_MANAGER_GTK; + else if (v == hash_variant("font_manager_t1")) return FONT_MANAGER_T1; + else assert(0); +} + +value +value_of_font_manager_id(FontManagerId id) +{ + switch (id) { + case FONT_MANAGER_GTK: + return hash_variant("font_manager_gtk"); + case FONT_MANAGER_T1: + return hash_variant("font_manager_t1"); + default: + assert(0); + break; + } +} + +ML_2 (gtk_math_view_new,GtkAdjustment_val, GtkAdjustment_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_mDOMNodeRef) +ML_2 (gtk_math_view_set_selection, GtkMathView_val, mDOMNodeRef_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) +ML_2 (gtk_math_view_set_font_manager_type, GtkMathView_val, font_manager_id_of_value, Unit) +ML_1 (gtk_math_view_get_font_manager_type, GtkMathView_val, value_of_font_manager_id) + +value +ml_gtk_math_view_export_to_postscript_native(value arg1, + value w, value h, value x0, value y0, value disable_colors, value arg2) +{ + CAMLparam5(arg1,w,h,x0,y0); + CAMLxparam2(disable_colors, arg2); + + char *filename; + FILE *fd; + int res; + filename = String_val (arg2); + if ((fd = fopen(filename, "w"))) { + gtk_math_view_export_to_postscript(GtkMathView_val (arg1), + Int_val(w), Int_val(h), Int_val(x0), Int_val(y0), Bool_val(disable_colors), 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_export_to_postscript_bytecode (value* arg, int argn) +{ + return ml_gtk_math_view_export_to_postscript_native(arg[0], arg[1], arg[2], arg[3], arg[4], arg[5], arg[6]); +} + +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; + CAMLlocal1 (tmp); + CAMLlocal1 (optval); + CAMLlocal1 (res); + + if (arg1==Val_int(0)) { + assert(0); + } else { + tmp = Field(arg1, 0); + nr = (mDOMNodeRef) Field(tmp, 1); + } + optval = Val_mDOMNodeRef(nr); + if (optval==Val_int(0)) { + assert(0); + } else { + res = Field(optval, 0); + } + + CAMLreturn(res); +} + +value ml_gtk_math_view_mDOMNode_option_of_bodex_option (value arg1) +{ + CAMLparam1(arg1); + + mDOMNodeRef nr; + CAMLlocal1 (tmp); + + if (arg1==Val_int(0)) { + nr=NULL; + } else { + tmp = Field(arg1, 0); + nr = (mDOMNodeRef) Field(tmp, 1); + } + + CAMLreturn(Val_mDOMNodeRef(nr)); +} diff --git a/helm/DEVEL/lablgtkmathview/test/.cvsignore b/helm/DEVEL/lablgtkmathview/test/.cvsignore new file mode 100644 index 000000000..1968614b7 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/test/.cvsignore @@ -0,0 +1 @@ +*.cmo *.cmi *.cmx t1lib.log test test.opt test.ps test.o diff --git a/helm/DEVEL/lablgtkmathview/test/Makefile b/helm/DEVEL/lablgtkmathview/test/Makefile new file mode 100644 index 000000000..d631d239f --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/test/Makefile @@ -0,0 +1,45 @@ +LABLGTK_DIR = /usr/lib/ocaml/lablgtk +LABLGTK_MATHVIEW_DIR = .. +MINIDOM_DIR = ../minidom +OCAMLC = ocamlc -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) \ + -I $(MINIDOM_DIR) -I mlmathview +OCAMLOPT = ocamlopt -I $(LABLGTK_DIR) -I $(LABLGTK_MATHVIEW_DIR) \ + -I $(MINIDOM_DIR) -I mlmathview + +all: test +opt: test.opt + +test: test.cmo + $(OCAMLC) -custom -o test lablgtk.cma gtkInit.cmo \ + $(MINIDOM_DIR)/minidom.cmo \ + $(MINIDOM_DIR)/ominidom.cmo \ + $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cma \ + -cclib "$(MINIDOM_DIR)/ml_minidom.o" \ + test.cmo \ + -cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \ + -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \ + -L/usr/local/lib/gtkmathview -lgtkmathview \ + $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o" + +test.opt: test.cmx + $(OCAMLOPT) -o test.opt lablgtk.cmxa gtkInit.cmx \ + $(MINIDOM_DIR)/minidom.cmx \ + $(MINIDOM_DIR)/ominidom.cmx \ + $(LABLGTK_MATHVIEW_DIR)/lablgtkmathview.cmxa \ + -cclib "$(MINIDOM_DIR)/ml_minidom.o" \ + test.cmx \ + -cclib "-lstr -L/usr/lib -L/usr/X11R6/lib -lgtk -lgdk \ + -rdynamic -lgmodule -lglib -ldl -lXi -lXext -lX11 -lm \ + -L/usr/local/lib/gtkmathview -lgtkmathview \ + $(LABLGTK_MATHVIEW_DIR)/ml_gtk_mathview.o" + +.SUFFIXES: .ml .mli .cmo .cmi .cmx +.ml.cmo: + $(OCAMLC) -c $< +.mli.cmi: + $(OCAMLC) -c $< +.ml.cmx: + $(OCAMLOPT) -c $< + +clean: + rm -f *.cm[iox] *.o test test.opt t1lib.log test.ps diff --git a/helm/DEVEL/lablgtkmathview/test/t1.config b/helm/DEVEL/lablgtkmathview/test/t1.config new file mode 100644 index 000000000..afb669e95 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/test/t1.config @@ -0,0 +1,3 @@ +ENCODING=. +AFM=/usr/share/texmf/fonts/afm/ +TYPE1=/usr/share/texmf/fonts/type1/bluesky/cm/:/usr/X11R6/lib/X11/fonts/Type1/:. diff --git a/helm/DEVEL/lablgtkmathview/test/test.ml b/helm/DEVEL/lablgtkmathview/test/test.ml new file mode 100644 index 000000000..3e2edeed1 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/test/test.ml @@ -0,0 +1,319 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of lablgtkmathview, the Ocaml binding + * for the GtkMathView widget. + * + * lablgtkmathview is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * lablgtkmathview 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with lablgtkmathview; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +(******************************************************************************) +(* Claudio Sacerdoti Coen *) +(* 25/09/2000 *) +(* *) +(* This is a simple test for the OCaml (LablGtk indeed) binding of the *) +(* MathView widget *) +(******************************************************************************) + +(* Callbacks *) +let jump (node : Ominidom.o_mDOMNode) = + let module O = Ominidom in + print_string ("jump: " ^ + (match node#get_attribute (O.o_mDOMString_of_string "href") with + | Some x -> x#get_string + | None -> "NO HREF FOR THIS NODE" + ) ^ "\n"); + flush stdout +;; + +let selection_changed mathview (node : Ominidom.o_mDOMNode option) = + let module O = Ominidom in + print_string ("selection_changed: " ^ + (match node with + None -> "selection_changed on nothing" + | Some node -> + match node#get_name with + | Some x -> x#get_string + | None -> "on element without name" + ) ^ "\n"); + mathview#set_selection node; + flush stdout +;; + + +let clicked (node : Ominidom.o_mDOMNode) = + let module O = Ominidom in + print_string ("clicked: " ^ + (match node#get_name with + | Some x -> x#get_string + | None -> "no name" + ) ^ "\n"); + flush stdout +;; + + +let activate_t1 mathview () = + mathview#set_font_manager_type `font_manager_t1; + print_string "WIDGET SET WITH T1 FONTS\n" ; + flush stdout +;; + +let activate_gtk mathview () = + mathview#set_font_manager_type `font_manager_gtk; + print_string "WIDGET SET WITH GTK FONTS\n" ; + flush stdout +;; + +let get_font_manager_type mathview () = + print_string "CURRENT FONT MANAGER TYPE: "; + begin + match mathview#get_font_manager_type with + | `font_manager_t1 -> print_string "T1" + | `font_manager_gtk -> print_string "GTK" + end; + print_newline(); + flush stdout +;; + +let load mathview () = + mathview#load "test.xml" ; + print_string "load: SEEMS TO WORK\n" ; + flush stdout +;; + +let get_selection mathview () = + let module O = Ominidom in + let selection = + match mathview#get_selection with + | Some node -> + begin + match node#get_name with + | Some name -> name#get_string + | None -> "element with no name!" + end + | None -> "no selection!" + in + print_string ("get_selection: " ^ selection ^ "\n") ; + flush stdout +;; + +let set_selection mathview () = + let module O = Ominidom in + begin + match mathview#get_selection with + | Some node -> + begin + try + let parent_node = node#get_parent in + mathview#set_selection (Some parent_node); + print_string "set selection: SEEMS TO WORK\n" + with + _ -> print_string "EXCEPTION: no parent\n" + end + | None -> + mathview#set_selection None; + print_string "no selection\n" + end ; + flush stdout +;; + +let unload mathview () = + mathview#unload ; + print_string "unload: SEEMS TO WORK\n" ; + flush stdout +;; + +let get_width mathview () = + print_string ("get_width: " ^ string_of_int (mathview#get_width) ^ "\n") ; + flush stdout +;; + +let get_height mathview () = + print_string ("get_height: " ^ string_of_int (mathview#get_height) ^ "\n") ; + flush stdout +;; + +let get_top mathview () = + let (x,y) = mathview#get_top in + print_string ("get_top: ("^ string_of_int x ^ "," ^ string_of_int y ^ ")\n") ; + flush stdout +;; + +let set_top mathview () = + mathview#set_top 0 0; + print_string "set_top: SEEM TO WORK\n" ; + flush stdout +;; + +let set_adjustments mathview () = + let adj1 = GData.adjustment () in + let adj2 = GData.adjustment () in + mathview#set_adjustments adj1 adj2 ; + adj1#set_value ((adj1#lower +. adj1#upper) /. 2.0) ; + adj2#set_value ((adj2#lower +. adj2#upper) /. 2.0) ; + print_string "set_adjustments: SEEM TO WORK\n" ; + flush stdout +;; + +let get_hadjustment mathview () = + let adj = mathview#get_hadjustment in + adj#set_value ((adj#lower +. adj#upper) /. 2.0) ; + print_string "get_hadjustment: SEEM TO WORK\n" ; + flush stdout +;; + +let get_vadjustment mathview () = + let adj = mathview#get_vadjustment in + adj#set_value ((adj#lower +. adj#upper) /. 2.0) ; + print_string "get_vadjustment: SEEM TO WORK\n" ; + flush stdout +;; + +let get_buffer mathview () = + let buffer = mathview#get_buffer in + Gdk.Draw.rectangle buffer (Gdk.GC.create buffer) ~x:0 ~y:0 + ~width:50 ~height:50 ~filled:true () ; + print_string "get_buffer: SEEMS TO WORK (hint: force the widget redrawing)\n"; + flush stdout +;; + +let get_frame mathview () = + let frame = mathview#get_frame in + frame#set_shadow_type `NONE ; + print_string "get_frame: SEEMS TO WORK\n" ; + flush stdout +;; + +let set_font_size mathview () = + mathview#set_font_size 24 ; + print_string "set_font_size: FONT IS NOW 24\n" ; + flush stdout +;; + +let get_font_size mathview () = + print_string ("get_font_size: " ^ string_of_int (mathview#get_font_size) ^ "\n") ; + flush stdout +;; + +let set_anti_aliasing mathview () = + mathview#set_anti_aliasing true ; + print_string "set_anti_aliasing: ON\n" ; + flush stdout +;; + +let get_anti_aliasing mathview () = + print_string ("get_anti_aliasing: " ^ + (match mathview#get_anti_aliasing with true -> "ON" | false -> "OFF") ^ + "\n") ; + flush stdout +;; + +let set_kerning mathview () = + mathview#set_kerning true ; + print_string "set_kerning: ON\n" ; + flush stdout +;; + +let get_kerning mathview () = + print_string ("get_kerning: " ^ + (match mathview#get_kerning with true -> "ON" | false -> "OFF") ^ + "\n") ; + flush stdout +;; + +let set_log_verbosity mathview () = + mathview#set_log_verbosity 3 ; + print_string "set_log_verbosity: NOW IS 3\n" ; + flush stdout +;; + +let get_log_verbosity mathview () = + print_string ("get_log_verbosity: " ^ + string_of_int mathview#get_log_verbosity ^ + "\n") ; + flush stdout +;; + +let export_to_postscript (mathview : GMathView.math_view) () = + mathview#export_to_postscript ~filename:"test.ps" (); + print_string "expor_to_postscript: SEEMS TO WORK (hint: look at test.ps)\n"; + flush stdout +;; + +(* Widget creation *) +let main_window = GWindow.window ~title:"GtkMathView test" () in +let vbox = GPack.vbox ~packing:main_window#add () in +let sw = GBin.scrolled_window ~width:50 ~height:50 ~packing:vbox#pack () in +let mathview= GMathView.math_view ~packing:sw#add ~width:50 ~height:50 () in +let table = GPack.table ~rows:6 ~columns:5 ~packing:vbox#pack () in +let button_gtk=GButton.button ~label:"activate Gtk fonts" ~packing:(table#attach ~left:0 ~top:0) () in +let button_load = GButton.button ~label:"load" ~packing:(table#attach ~left:1 ~top:0) () in +let button_unload = GButton.button ~label:"unload" ~packing:(table#attach ~left:2 ~top:0) () in +let button_get_selection = GButton.button ~label:"get_selection" ~packing:(table#attach ~left:3 ~top:0) () in +let button_set_selection = GButton.button ~label:"set_selection" ~packing:(table#attach ~left:4 ~top:0) () in +let button_get_width = GButton.button ~label:"get_width" ~packing:(table#attach ~left:0 ~top:1) () in +let button_get_height = GButton.button ~label:"get_height" ~packing:(table#attach ~left:1 ~top:1) () in +let button_get_top = GButton.button ~label:"get_top" ~packing:(table#attach ~left:2 ~top:1) () in +let button_set_top = GButton.button ~label:"set_top" ~packing:(table#attach ~left:3 ~top:1) () in +let button_set_adjustments = GButton.button ~label:"set_adjustments" ~packing:(table#attach ~left:4 ~top:1) () in +let button_get_hadjustment = GButton.button ~label:"get_hadjustment" ~packing:(table#attach ~left:0 ~top:2) () in +let button_get_vadjustment = GButton.button ~label:"get_vadjustment" ~packing:(table#attach ~left:1 ~top:2) () in +let button_get_buffer = GButton.button ~label:"get_buffer" ~packing:(table#attach ~left:2 ~top:2) () in +let button_get_frame = GButton.button ~label:"get_frame" ~packing:(table#attach ~left:3 ~top:2) () in +let button_set_font_size = GButton.button ~label:"set_font_size" ~packing:(table#attach ~left:4 ~top:2) () in +let button_get_font_size = GButton.button ~label:"get_font_size" ~packing:(table#attach ~left:0 ~top:3) () in +let button_set_anti_aliasing = GButton.button ~label:"set_anti_aliasing" ~packing:(table#attach ~left:1 ~top:3) () in +let button_get_anti_aliasing = GButton.button ~label:"get_anti_aliasing" ~packing:(table#attach ~left:2 ~top:3) () in +let button_set_kerning = GButton.button ~label:"set_kerning" ~packing:(table#attach ~left:3 ~top:3) () in +let button_get_kerning = GButton.button ~label:"get_kerning" ~packing:(table#attach ~left:4 ~top:3) () in +let button_set_log_verbosity = GButton.button ~label:"set_log_verbosity" ~packing:(table#attach ~left:0 ~top:4) () in +let button_get_log_verbosity = GButton.button ~label:"get_log_verbosity" ~packing:(table#attach ~left:1 ~top:4) () in +let button_export_to_postscript = GButton.button ~label:"export_to_postscript" ~packing:(table#attach ~left:2 ~top:4) () in +let button_t1 = GButton.button ~label:"activate T1 fonts" ~packing:(table#attach ~left:3 ~top:4) () in +let button_get_font_manager_type = GButton.button ~label:"get_font_manager" ~packing:(table#attach ~left:4 ~top:4) () in +(* Signals connection *) +ignore(button_gtk#connect#clicked (activate_gtk mathview)) ; +ignore(button_load#connect#clicked (load mathview)) ; +ignore(button_unload#connect#clicked (unload mathview)) ; +ignore(button_get_selection#connect#clicked (get_selection mathview)) ; +ignore(button_set_selection#connect#clicked (set_selection mathview)) ; +ignore(button_get_width#connect#clicked (get_width mathview)) ; +ignore(button_get_height#connect#clicked (get_height mathview)) ; +ignore(button_get_top#connect#clicked (get_top mathview)) ; +ignore(button_set_top#connect#clicked (set_top mathview)) ; +ignore(button_set_adjustments#connect#clicked (set_adjustments mathview)) ; +ignore(button_get_hadjustment#connect#clicked (get_hadjustment mathview)) ; +ignore(button_get_vadjustment#connect#clicked (get_vadjustment mathview)) ; +ignore(button_get_buffer#connect#clicked (get_buffer mathview)) ; +ignore(button_get_frame#connect#clicked (get_frame mathview)) ; +ignore(button_set_font_size#connect#clicked (set_font_size mathview)) ; +ignore(button_get_font_size#connect#clicked (get_font_size mathview)) ; +ignore(button_set_anti_aliasing#connect#clicked (set_anti_aliasing mathview)) ; +ignore(button_get_anti_aliasing#connect#clicked (get_anti_aliasing mathview)) ; +ignore(button_set_kerning#connect#clicked (set_kerning mathview)) ; +ignore(button_get_kerning#connect#clicked (get_kerning mathview)) ; +ignore(button_set_log_verbosity#connect#clicked (set_log_verbosity mathview)) ; +ignore(button_get_log_verbosity#connect#clicked (get_log_verbosity mathview)) ; +ignore(button_export_to_postscript#connect#clicked (export_to_postscript mathview)) ; +ignore(button_t1#connect#clicked (activate_t1 mathview)) ; +ignore(button_get_font_manager_type#connect#clicked (get_font_manager_type mathview)) ; +ignore(mathview#connect#jump jump) ; +ignore(mathview#connect#clicked clicked) ; +ignore(mathview#connect#selection_changed (selection_changed mathview)) ; +(* Main Loop *) +main_window#show () ; +GMain.Main.main () +;; diff --git a/helm/DEVEL/lablgtkmathview/test/test.xml b/helm/DEVEL/lablgtkmathview/test/test.xml new file mode 100644 index 000000000..b0f8c1563 --- /dev/null +++ b/helm/DEVEL/lablgtkmathview/test/test.xml @@ -0,0 +1,123 @@ + + + + + + + + a + + x + + + + b + + + + x + 2 + + + + + p + + x + + + + q + + + + d + x + = + + + a2 + + + ln + + + ( + + x2 + + + + p + + x + + + + q + + ) + + + + + + + + + + 2 + + b + + - + + a + + p + + + + + + 4 + + q + + - + + p + 2 + + + + + + + arctg + + + + + 2 + + x + + + + p + + + + + 4 + + q + + - + + p + 2 + + + + + + + + + c + + diff --git a/helm/DEVEL/mlminidom/.cvsignore b/helm/DEVEL/mlminidom/.cvsignore new file mode 100644 index 000000000..90e9bb4c0 --- /dev/null +++ b/helm/DEVEL/mlminidom/.cvsignore @@ -0,0 +1,6 @@ +*.cmi *.cmo *.cmx test test.opt +configure +config.status +config.log +config.cache +Makefile diff --git a/helm/DEVEL/mlminidom/AUTHORS b/helm/DEVEL/mlminidom/AUTHORS new file mode 100644 index 000000000..3598094a9 --- /dev/null +++ b/helm/DEVEL/mlminidom/AUTHORS @@ -0,0 +1,2 @@ +Luca Padovani +Claudio Sacerdoti Coen diff --git a/helm/DEVEL/mlminidom/COPYING b/helm/DEVEL/mlminidom/COPYING new file mode 100644 index 000000000..d60c31a97 --- /dev/null +++ b/helm/DEVEL/mlminidom/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/helm/DEVEL/mlminidom/ChangeLog b/helm/DEVEL/mlminidom/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/helm/DEVEL/mlminidom/Makefile.in b/helm/DEVEL/mlminidom/Makefile.in new file mode 100644 index 000000000..e311c5e1c --- /dev/null +++ b/helm/DEVEL/mlminidom/Makefile.in @@ -0,0 +1,69 @@ +PACKAGE = @PACKAGE@ +VERSION = @MLMINIDOM_VERSION@ +LIBDIR = @OCAML_ROOT@ +INSTALLDIR = $(LIBDIR)/mlminidom +OBJECTS = minidom.cmi minidom.cmo ml_minidom.o ominidom.cmi ominidom.cmo +OBJECTS_OPT = minidom.cmx ominidom.cmx +INST = minidom.o ominidom.o ml_minidom.h minidom.mli +DIST_FILES = Makefile.in configure.in configure *.ml *.mli test.xml ml_minidom.c ml_minidom.h +DOC_FILES = AUTHORS COPYING ChangeLog NEWS README + +all: $(OBJECTS) test + +opt: $(OBJECTS_OPT) test.opt + +dist: + rm -rf $(PACKAGE)-$(VERSION) + mkdir $(PACKAGE)-$(VERSION) + cp $(DIST_FILES) $(DOC_FILES) $(PACKAGE)-$(VERSION) + tar cvfz $(PACKAGE)-$(VERSION).tar.gz $(PACKAGE)-$(VERSION) + rm -rf $(PACKAGE)-$(VERSION) + +ml_minidom.o: ml_minidom.c + gcc -c -I$(LIBDIR)/caml/ `glib-config --cflags` `minidom-config --cflags` $< + +minidom.cmi: minidom.mli + ocamlc -c $< + +minidom.cmo: minidom.ml minidom.cmi + ocamlc -c $< + +minidom.cmx: minidom.ml minidom.cmi + ocamlopt -c $< + +ominidom.cmi: ominidom.mli + ocamlc -c $< + +ominidom.cmo: ominidom.ml + ocamlc -c $< + +ominidom.cmx: ominidom.ml + ocamlopt -c $< + +test.cmo: test.ml minidom.cmo + ocamlc -c test.ml + +test.cmx: test.ml minidom.cmx + ocamlopt -c test.ml + +test: test.cmo minidom.cmo ml_minidom.o + ocamlc -custom -o test minidom.cmo test.cmo ml_minidom.o \ + -cclib "`glib-config --libs` `minidom-config --libs`" + +test.opt: test.cmx minidom.cmx ml_minidom.o + ocamlopt -o test.opt minidom.cmx test.cmx ml_minidom.o \ + -cclib "`glib-config --libs` `minidom-config --libs`" + +install: + if test -d $(INSTALLDIR); then : ; else mkdir -p $(INSTALLDIR); fi + cp $(OBJECTS) $(OBJECTS_OPT) $(INST) $(INSTALLDIR) + +uninstall: + rm -rf $(INSTALLDIR) + +clean: + rm -f *.o *.cm? test test.opt + +distclean: clean + rm -f configure config.log config.cache config.status Makefile + diff --git a/helm/DEVEL/mlminidom/NEWS b/helm/DEVEL/mlminidom/NEWS new file mode 100644 index 000000000..e69de29bb diff --git a/helm/DEVEL/mlminidom/README b/helm/DEVEL/mlminidom/README new file mode 100644 index 000000000..c74b582e2 --- /dev/null +++ b/helm/DEVEL/mlminidom/README @@ -0,0 +1,9 @@ +This is the Ocaml binding for minidom. + +To compile and install: + + ./configure + make + make opt + make install + diff --git a/helm/DEVEL/mlminidom/configure.in b/helm/DEVEL/mlminidom/configure.in new file mode 100644 index 000000000..2f761151b --- /dev/null +++ b/helm/DEVEL/mlminidom/configure.in @@ -0,0 +1,33 @@ +AC_INIT(minidom.ml) + +PACKAGE=mlminidom + +MLMINIDOM_MAJOR_VERSION=0 +MLMINIDOM_MINOR_VERSION=0 +MLMINIDOM_MICRO_VERSION=1 +MLMINIDOM_VERSION=$MLMINIDOM_MAJOR_VERSION.$MLMINIDOM_MINOR_VERSION.$MLMINIDOM_MICRO_VERSION + +AC_CHECK_PROG(HAVE_GLIB, glib-config, yes, no) +if test $HAVE_GLIB = "no"; then + AC_MSG_ERROR(could not font glib configuration script, please make sure glib (dev) is installed) +fi + +AC_CHECK_PROG(HAVE_MINIDOM, minidom-config, yes, no) +if test $HAVE_MINIDOM = "no"; then + AC_MSG_ERROR(could not find minidom configuration script, please make sure minidom is installed) +fi + +AC_CHECK_PROG(HAVE_OCAMLC, ocamlc, yes, no) +if test $HAVE_OCAMLC = "no"; then + AC_MSG_ERROR(could not find ocamlc in PATH, please make sure ocaml is installed) +fi + +AC_MSG_CHECKING("for the ocaml library dir") +OCAML_ROOT=`ocamlc -v | grep "^Standard" | sed 's/^.*: *//'` +AC_MSG_RESULT($OCAML_ROOT) + +AC_SUBST(PACKAGE) +AC_SUBST(MLMINIDOM_VERSION) +AC_SUBST(OCAML_ROOT) + +AC_OUTPUT([Makefile]) diff --git a/helm/DEVEL/mlminidom/minidom.ml b/helm/DEVEL/mlminidom/minidom.ml new file mode 100644 index 000000000..118b0d070 --- /dev/null +++ b/helm/DEVEL/mlminidom/minidom.ml @@ -0,0 +1,81 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of mlminidom, the Ocaml binding for minidom. + * + * mlminidom is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * mlminidom 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with mlminidom; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +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)) + diff --git a/helm/DEVEL/mlminidom/minidom.mli b/helm/DEVEL/mlminidom/minidom.mli new file mode 100644 index 000000000..36355af31 --- /dev/null +++ b/helm/DEVEL/mlminidom/minidom.mli @@ -0,0 +1,70 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of mlminidom, the Ocaml binding for minidom. + * + * mlminidom is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * mlminidom 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with mlminidom; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +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 : doc:mDOMDoc -> name:mDOMString -> content:mDOMString -> mDOMEntity = "ml_doc_add_entity" +external doc_get_entity : doc:mDOMDoc -> name:mDOMString -> mDOMEntity option = "ml_doc_get_entity" +external doc_get_predefined_entity : doc:mDOMDoc -> name: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 : node:mDOMNode -> name:mDOMString -> mDOMString option = "ml_node_get_attribute" +external node_get_attribute_ns : node:mDOMNode -> name:mDOMString -> ns_uri: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 + diff --git a/helm/DEVEL/mlminidom/ml_minidom.c b/helm/DEVEL/mlminidom/ml_minidom.c new file mode 100644 index 000000000..7e304ccb5 --- /dev/null +++ b/helm/DEVEL/mlminidom/ml_minidom.c @@ -0,0 +1,308 @@ +/* Copyright (C) 2000, Luca Padovani . + * + * This file is part of mlminidom, the Ocaml binding for minidom. + * + * mlminidom is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * mlminidom 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with mlminidom; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + */ + +#include +#include +#include + +#include "minidom.h" + +#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)) + +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_content(value node) +{ + CAMLparam1(node); + CAMLreturn(Val_option(mdom_node_get_content((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)); +} + diff --git a/helm/DEVEL/mlminidom/ml_minidom.h b/helm/DEVEL/mlminidom/ml_minidom.h new file mode 100644 index 000000000..4b92566b9 --- /dev/null +++ b/helm/DEVEL/mlminidom/ml_minidom.h @@ -0,0 +1,38 @@ +/* Copyright (C) 2000, Luca Padovani . + * + * This file is part of mlminidom, the Ocaml binding for minidom. + * + * mlminidom is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * mlminidom 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with mlminidom; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + */ + +#ifndef ml_minidom_h +#define ml_minidom_h + +#define Val_ptr(p) ((value) (p)) +#ifndef Val_option +#define Val_option(p,f) ((p != NULL) ? ml_some(f(p)) : Val_unit) +#endif /* Val_option */ +#define Val_mDOMString(s) (copy_string((char*) (s))) +#define mDOMString_val(v) ((mDOMStringRef) String_val(v)) +#define mDOMNode_val(v) ((mDOMNodeRef) v) + +#define mDOMNode_option_mDOMNodeRef(p) (((p) != NULL) ? ml_some((value) (p)) : Val_unit) +#define mDOMNodeRef_mDOMNode_option(v) ((v == Val_unit) ? NULL : (mDOMNodeRef)Field((v),0)) +#define Val_mDOMNodeRef(p) (mDOMNode_option_mDOMNodeRef(p)) +#define mDOMNodeRef_val(v) (mDOMNodeRef_mDOMNode_option(v)) + +#endif /* ml_minidom_h */ diff --git a/helm/DEVEL/mlminidom/mlminidom-0.0.1-1.spec b/helm/DEVEL/mlminidom/mlminidom-0.0.1-1.spec new file mode 100644 index 000000000..3336a484c --- /dev/null +++ b/helm/DEVEL/mlminidom/mlminidom-0.0.1-1.spec @@ -0,0 +1,27 @@ +Summary: The Ocaml binding for the minidom library +Name: mlminidom +Version: 0.0.1 +Release: 1 +Copyright: GPL +URL: http://www.cs.unibo.it/helm +Packager: Luca Padovani +Requires: ocaml >= 3.00, minidom >= 0.0.1, glib, glib-devel +Group: Applications/Publishing +Source: www.cs.unibo.it:/~lpadovan/mml-widget/mlminidom-0.0.1.tar.gz +%description +The Ocaml binding for the minidom library + +%prep +%setup + +%build +./configure + +%install +make +make opt +make install + +%files +%doc AUTHORS COPYING ChangeLog NEWS README +/usr/lib/ocaml/mlminidom diff --git a/helm/DEVEL/mlminidom/ominidom.ml b/helm/DEVEL/mlminidom/ominidom.ml new file mode 100644 index 000000000..343dfa3be --- /dev/null +++ b/helm/DEVEL/mlminidom/ominidom.ml @@ -0,0 +1,176 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of mlminidom, the Ocaml binding for minidom. + * + * mlminidom is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * mlminidom 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with mlminidom; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +exception Node_has_no_parent;; +exception Node_has_no_sibling of string;; +exception Node_has_no_children;; +exception Node_has_no_attributes;; +exception Attribute_has_no_sibling of string;; +exception Attribute_has_no_parent;; +exception Undefined_entity;; + +let option_to_exception v e = + match v with + Some x -> x + | None -> raise e +;; + +class o_mDOMString (str: Minidom.mDOMString) = + object + method get_dom_string = str + method get_string = Minidom.string_of_mDOMString str + end;; + +let o_mDOMString_of_string str = + new o_mDOMString (Minidom.mDOMString_of_string str) + +class o_mDOMEntity (ent : Minidom.mDOMEntity) = + object + method get_dom_entity = ent + method get_content = + new o_mDOMString (Minidom.entity_get_content ent) + end +;; + +class o_mDOMDoc (doc : Minidom.mDOMDoc) = + object + method get_dom_doc = doc + + method get_root_node = + new o_mDOMNode (Minidom.doc_get_root_node doc) + method add_entity (name : o_mDOMString) (value : o_mDOMString) = + new o_mDOMEntity + (Minidom.doc_add_entity doc + (name#get_dom_string) (value#get_dom_string) + ) + method get_entity (name : o_mDOMString) = + match Minidom.doc_get_entity doc (name#get_dom_string) with + | Some x -> new o_mDOMEntity x + | None -> raise Undefined_entity + method get_predefined_entity (name : o_mDOMString) = + match Minidom.doc_get_predefined_entity doc (name#get_dom_string) with + | Some x -> new o_mDOMEntity x + | None -> raise Undefined_entity + end +and o_mDOMNode (node : Minidom.mDOMNode) = + object + method get_dom_node = node + + method is_text = Minidom.node_is_text node + method is_element = Minidom.node_is_element node + method is_blank = Minidom.node_is_blank node + method is_entity_ref = Minidom.node_is_entity_ref node + + method get_type = Minidom.node_get_type node + method get_name = + match Minidom.node_get_name node with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_ns_uri = + match Minidom.node_get_ns_uri node with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_attribute (name : o_mDOMString) = + match Minidom.node_get_attribute node (name#get_dom_string) with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_attribute_ns (name : o_mDOMString) (uri : o_mDOMString) = + match + Minidom.node_get_attribute_ns node + (name#get_dom_string) (uri#get_dom_string) + with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_content = + match Minidom.node_get_content node with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_parent = + new o_mDOMNode + (option_to_exception (Minidom.node_get_parent node) Node_has_no_parent) + method get_prev_sibling = + new o_mDOMNode + (option_to_exception + (Minidom.node_get_prev_sibling node) + (Node_has_no_sibling "left") + ) + method get_next_sibling = + new o_mDOMNode + (option_to_exception + (Minidom.node_get_next_sibling node) + (Node_has_no_sibling "right") + ) + method get_first_child = + new o_mDOMNode + (option_to_exception + (Minidom.node_get_first_child node) + (Node_has_no_children) + ) + method get_first_attribute = + new o_mDOMAttr + (option_to_exception + (Minidom.node_get_first_attribute node) + (Node_has_no_attributes) + ) + method is_first = Minidom.node_is_first node + method is_last = Minidom.node_is_last node + + method get_children = + List.map (function x -> new o_mDOMNode x) (Minidom.node_get_children node) + method get_attributes = List.map + (function x -> new o_mDOMAttr x) (Minidom.node_get_attributes node) + end +and o_mDOMAttr (attr : Minidom.mDOMAttr) = + object + method get_dom_attr = attr + + method get_name = + match Minidom.attr_get_name attr with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_ns_uri = + match Minidom.attr_get_ns_uri attr with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_value = + match Minidom.attr_get_value attr with + | Some x -> Some (new o_mDOMString x) + | None -> None + method get_prev_sibling = + new o_mDOMAttr + (option_to_exception + (Minidom.attr_get_prev_sibling attr) + (Attribute_has_no_sibling "left") + ) + method get_next_sibling = + new o_mDOMAttr + (option_to_exception + (Minidom.attr_get_next_sibling attr) + (Attribute_has_no_sibling "right") + ) + method get_parent = + new o_mDOMNode + (option_to_exception + (Minidom.attr_get_parent attr) Attribute_has_no_parent + ) + end +;; + diff --git a/helm/DEVEL/mlminidom/ominidom.mli b/helm/DEVEL/mlminidom/ominidom.mli new file mode 100644 index 000000000..42b7d67ea --- /dev/null +++ b/helm/DEVEL/mlminidom/ominidom.mli @@ -0,0 +1,85 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of mlminidom, the Ocaml binding for minidom. + * + * mlminidom is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * mlminidom 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with mlminidom; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +exception Node_has_no_parent +exception Node_has_no_sibling of string +exception Node_has_no_children +exception Node_has_no_attributes +exception Attribute_has_no_sibling of string +exception Attribute_has_no_parent +exception Undefined_entity + +class o_mDOMString : Minidom.mDOMString -> + object + method get_dom_string : Minidom.mDOMString + method get_string : string + end + +val o_mDOMString_of_string : string -> o_mDOMString + +class o_mDOMEntity : Minidom.mDOMEntity -> + object + method get_content : o_mDOMString + method get_dom_entity : Minidom.mDOMEntity + end + +class o_mDOMDoc : Minidom.mDOMDoc -> + object + method add_entity : o_mDOMString -> o_mDOMString -> o_mDOMEntity + method get_dom_doc : Minidom.mDOMDoc + method get_entity : o_mDOMString -> o_mDOMEntity + method get_predefined_entity : o_mDOMString -> o_mDOMEntity + method get_root_node : o_mDOMNode + end +and o_mDOMNode : Minidom.mDOMNode -> + object + method get_attribute : o_mDOMString -> o_mDOMString option + method get_attribute_ns : + o_mDOMString -> o_mDOMString -> o_mDOMString option + method get_attributes : o_mDOMAttr list + method get_children : o_mDOMNode list + method get_content : o_mDOMString option + method get_dom_node : Minidom.mDOMNode + method get_first_attribute : o_mDOMAttr + method get_first_child : o_mDOMNode + method get_name : o_mDOMString option + method get_next_sibling : o_mDOMNode + method get_ns_uri : o_mDOMString option + method get_parent : o_mDOMNode + method get_prev_sibling : o_mDOMNode + method get_type : int + method is_blank : bool + method is_element : bool + method is_entity_ref : bool + method is_first : bool + method is_last : bool + method is_text : bool + end +and o_mDOMAttr : Minidom.mDOMAttr -> + object + method get_dom_attr : Minidom.mDOMAttr + method get_name : o_mDOMString option + method get_next_sibling : o_mDOMAttr + method get_ns_uri : o_mDOMString option + method get_parent : o_mDOMNode + method get_prev_sibling : o_mDOMAttr + method get_value : o_mDOMString option + end diff --git a/helm/DEVEL/mlminidom/test.ml b/helm/DEVEL/mlminidom/test.ml new file mode 100644 index 000000000..1a239f8f6 --- /dev/null +++ b/helm/DEVEL/mlminidom/test.ml @@ -0,0 +1,104 @@ +(* Copyright (C) 2000, Luca Padovani . + * + * This file is part of mlminidom, the Ocaml binding for minidom. + * + * mlminidom is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * mlminidom 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with mlminidom; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, send a mail to the author. + *) + +let doc = Minidom.doc_load "test.xml" + +let root = Minidom.doc_get_root_node doc + +let check_attribute_ns attr = + Printf.printf "\n\n"; + let ns_uri = Minidom.attr_get_ns_uri attr + and attr_name = Minidom.attr_get_name attr + and attr_value = Minidom.attr_get_value attr + and parent = Minidom.attr_get_parent attr + in + match parent,ns_uri,attr_name,attr_value with + Some parent_node,Some uri,Some attribute_name,Some attribute_value -> + let attr_value = Minidom.node_get_attribute_ns parent_node attribute_name uri + in begin + match attr_value with + Some attr1 -> + Printf.printf "found the attribute with ns %s (was %s)\n" + (Minidom.string_of_mDOMString attr1) (Minidom.string_of_mDOMString attribute_value) + | None -> + Printf.printf "attribute not found (uri was %s)!!!!\n" (Minidom.string_of_mDOMString uri) + end + | _ -> + Printf.printf "parent_node == NULL || uri == NULL || attribute_name == NULL || attribute_value == NULL\n" +;; + +let print_attribute attr = + check_attribute_ns attr; + let ns_uri = Minidom.attr_get_ns_uri attr + in + begin + match ns_uri with + Some uri -> Printf.printf " %s:" (Minidom.string_of_mDOMString uri); + | None -> () + end; + match ((Minidom.attr_get_name attr), (Minidom.attr_get_value attr)) with + (Some attr_name, Some attr_value) -> + Printf.printf " %s=\"%s\"" (Minidom.string_of_mDOMString attr_name) (Minidom.string_of_mDOMString attr_value) + | (Some attr_name, _) -> + Printf.printf " ??? attribute %s has no value !!!" (Minidom.string_of_mDOMString attr_name) + | (_,_) -> + Printf.printf " ??? very strange attribute !!!" +;; + +let rec print_node n node = + if Minidom.node_is_blank node then () + else if Minidom.node_is_element node then begin + match Minidom.node_get_name node with + Some node_name -> + begin + let children = Minidom.node_get_children node + and attributes = Minidom.node_get_attributes node + and ns_uri = Minidom.node_get_ns_uri node + and is_first,is_last = (Minidom.node_is_first node), (Minidom.node_is_last node) + in + for i = 1 to n do print_char ' ' done; + Printf.printf "<"; + begin + match ns_uri with + Some uri -> Printf.printf "%s:" (Minidom.string_of_mDOMString uri) + | None -> () + end; + Printf.printf "%s" (Minidom.string_of_mDOMString node_name); + List.iter print_attribute attributes; + Printf.printf ">\n"; + List.iter (print_node (n + 2)) children; + for i = 1 to n do print_char ' ' done; + Printf.printf "\n" (Minidom.string_of_mDOMString node_name) + end + | None -> Printf.printf "??? this node has no name !!!\n" + end else if Minidom.node_is_text node then begin + match Minidom.node_get_content node with + Some node_content -> + for i = 1 to n do print_char ' ' done; + Printf.printf "%s\n" (Minidom.string_of_mDOMString node_content) + | None -> Printf.printf "??? this node has no content !!!\n" + end else begin + Printf.printf "don't know how to manage a node with type %d\n" (Minidom.node_get_type node) + end +;; + +print_node 0 root;; + diff --git a/helm/DEVEL/mlminidom/test.xml b/helm/DEVEL/mlminidom/test.xml new file mode 100644 index 000000000..83d2eef68 --- /dev/null +++ b/helm/DEVEL/mlminidom/test.xml @@ -0,0 +1,505 @@ + + + + + + + + DEFINITION and_ind() OF TYPE + + + + + + + + __ + + + + + + + + ( + + + + + Π + A + : + + Prop + + + + + + + . + + + + + Π + B + : + + Prop + + + + + + + . + + + + + Π + P + : + + Prop + + + + + + + . + + + + + Π + f + : + + ( + A + + + ( + B + + P + ) + + ) + + + + + + + . + + Π + a + : + + ( + and + + _ + + A + + _ + + B + ) + + . + P + + + + + + + + + + + + + + + + + + + + + + + + + + + + :> + + Prop + + + + + + + + ) + + + + + + + + cast + + prod + + A + + + Prop + + + + + prod + + B + + + Prop + + + + + prod + + P + + + Prop + + + + + prod + + f + + + arrow + A + + arrow + B + P + + + + + + prod + + a + + + app + and + A + B + + + + P + + + + + + + Prop + + + + + + + + + + + AS + + + + + + + + __ + + + + + + + λ + A + : + + Prop + + + + + + + . + + + + + λ + B + : + + Prop + + + + + + + . + + + + + λ + P + : + + Prop + + + + + + + . + + + + + λ + f + : + + ( + A + + + ( + B + + P + ) + + ) + + + + + + + . + + + + + λ + a + : + + ( + and + + _ + + A + + _ + + B + ) + + + + + + + . + + < + P + > + CASES + + _ + + a + + _ + + OF + + ( + conj + + _ + + $1 + + _ + + $2 + ) + + + + ( + f + + _ + + $1 + + _ + + $2 + ) + + + _ + + END + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A + + + Prop + + + + + + B + + + Prop + + + + + + P + + + Prop + + + + + + f + + + arrow + A + + arrow + B + P + + + + + + + a + + + app + and + A + B + + + + + mutcase + P + a + + app + conj + $1 + $2 + + + app + f + $1 + $2 + + + + + + + + + + + + + + diff --git a/helm/helmpot/.cvsignore b/helm/helmpot/.cvsignore new file mode 100644 index 000000000..356892530 --- /dev/null +++ b/helm/helmpot/.cvsignore @@ -0,0 +1,16 @@ +.emacs.desktop +config.h +config.h.in +config.cache +config.log +config.status +configure +configure.scan +t1lib.log +stamp-h +stamp-h.in +Makefile +Makefile.in +*.gz +aclocal.m4 +*.spec diff --git a/helm/helmpot/AUTHORS b/helm/helmpot/AUTHORS new file mode 100644 index 000000000..fe59f14d6 --- /dev/null +++ b/helm/helmpot/AUTHORS @@ -0,0 +1 @@ +Luca Padovani diff --git a/helm/helmpot/ChangeLog b/helm/helmpot/ChangeLog new file mode 100644 index 000000000..e69de29bb diff --git a/helm/helmpot/LICENSE b/helm/helmpot/LICENSE new file mode 100644 index 000000000..eef8774f4 --- /dev/null +++ b/helm/helmpot/LICENSE @@ -0,0 +1,23 @@ +/* + * Copyright (C) 2000, Luca Padovani . + * + * This file is part of HelmPot, a minimal browser for HELM. + * + * HelmPot is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HelmPot 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HelmPot; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, see the HelmPot World-Wide-Web page, + * http://cs.unibo.it/helm/helmview, or send a mail to + * + */ diff --git a/helm/helmpot/Makefile.am b/helm/helmpot/Makefile.am new file mode 100644 index 000000000..7d2fefe67 --- /dev/null +++ b/helm/helmpot/Makefile.am @@ -0,0 +1,23 @@ + +CLEANFILES = core t1lib.log helmpot.spec + +bin_PROGRAMS = helmpot + +noinst_HEADERS = guiGTK.h + +helmpot_SOURCES = \ + main.c \ + guiGTK.c + +backup: + tar cvfz ../@PACKAGE@-@VERSION@-`date|tr ' ' '_'|tr ':' '_'`.tar.gz . + +cleanbak: + -rm -f `find . -name "*~"` + +lc: + @( \ + CFILES=`find . -name "*.c"`; \ + HFILES=`find . -name "*.h"`; \ + wc -l $$CFILES $$HFILES | tail -n 1 \ + ) diff --git a/helm/helmpot/NEWS b/helm/helmpot/NEWS new file mode 100644 index 000000000..e69de29bb diff --git a/helm/helmpot/README b/helm/helmpot/README new file mode 100644 index 000000000..2e7cb0da0 --- /dev/null +++ b/helm/helmpot/README @@ -0,0 +1,18 @@ + +HELMPoT +------- + +HELMPoT is a small plug-out for Netscape Navigator in order to +browse the HELM library. After installing the binary somewhere +in your hard disk, just configure a new helper application in +Netscape associated to the text/xml MIME type. The command +to be executed should something of the kind: + + helmpot '%s' + +assuming that helmpot is visible in your path. + +Enjoy, + + luca.padovani@cs.unibo.it + diff --git a/helm/helmpot/acconfig.h b/helm/helmpot/acconfig.h new file mode 100644 index 000000000..887d86861 --- /dev/null +++ b/helm/helmpot/acconfig.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2000, Luca Padovani . + * + * This file is part of HelmView, a minimal browser for HELM. + * + * HelmView is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HelmView 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HelmView; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, see the HelmView World-Wide-Web page, + * http://cs.unibo.it/helm/helmview, or send a mail to + * + */ + +#ifndef __config_h__ +#define __config_h__ + +#define PRIVATE static + +@TOP@ + +/* If defined the widget will perform a huge amount + * of validity checks while running + */ +#undef ENABLE_CHECKS + +#ifdef ENABLE_CHECKS +#define DEBUG +#else +#define NDEBUG +#define G_DISABLE_ASSERT +#define G_DISABLE_CHECKS +#endif + +@BOTTOM@ + +#endif /* __config_h__ */ diff --git a/helm/helmpot/configure.in b/helm/helmpot/configure.in new file mode 100644 index 000000000..a5682856b --- /dev/null +++ b/helm/helmpot/configure.in @@ -0,0 +1,86 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(main.c) + +HELMPOT_MAJOR_VERSION=0 +HELMPOT_MINOR_VERSION=0 +HELMPOT_MICRO_VERSION=1 +HELMPOT_VERSION=$HELMPOT_MAJOR_VERSION.$HELMPOT_MINOR_VERSION.$HELMPOT_MICRO_VERSION +VERSION=$HELMPOT_VERSION + +AC_SUBST(HELMPOT_VERSION) + +AC_ARG_ENABLE( + checks, + [ --enable-checks[=ARG] include debugging checks [default=yes]], + [ + if test $enableval = yes; then + AC_DEFINE(ENABLE_CHECKS) + fi + ], + AC_DEFINE(ENABLE_CHECKS) +) + +dnl Automake configuration +AM_CONFIG_HEADER(config.h) +AM_INIT_AUTOMAKE(helmpot, $HELMPOT_VERSION) + +dnl Checks for programs. +AC_LANG_C +AC_PROG_CC +AC_ISC_POSIX +AC_CHECK_PROG(HAVE_COLORGCC, colorgcc, yes, no) + +dnl Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS(unistd.h) +AC_FUNC_VFORK + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +dnl Check for iconv with const pointer as second argument +AC_LANG_C + +dnl Checks for libraries +AC_CHECK_LIB(gtk, gtk_window_new, + [ + CFLAGS="$CFLAGS `gtk-config --cflags`" + CXXFLAGS="$CXXFLAGS `gtk-config --cflags`" + LIBS="$LIBS `gtk-config --libs`" + ], + AC_MSG_ERROR(could not find GTK), + `gtk-config --libs` +) + +AC_CHECK_LIB(minidom, mdom_node_get_type, + [ + CFLAGS="$CFLAGS `minidom-config --cflags`" + CXXFLAGS="$CXXFLAGS `minidom-config --cflags`" + LIBS="$LIBS `minidom-config --libs`" + ], + AC_MSG_ERROR(could not find minidom), + `minidom-config --libs` `glib-config --libs` +) + +AC_CHECK_LIB(gtkmathview, gtk_math_view_new, + [ + CFLAGS="$CFLAGS `gtkmathview-config --cflags`" + CXXFLAGS="$CXXFLAGS `gtkmathview-config --cflags`" + LIBS="$LIBS `gtkmathview-config --libs`" + ], + AC_MSG_ERROR(cound not find gtkmathview), + `gtkmathview-config --libs` +) + +if test $HAVE_COLORGCC = "yes"; then + CC=colorgcc + CXX=colorgcc +fi + +CFLAGS="$CFLAGS -W -Wall" +CXXFLAGS="$CXXFLAGS -W -Wall" + +AC_OUTPUT([ +Makefile +helmpot.spec +]) diff --git a/helm/helmpot/guiGTK.c b/helm/helmpot/guiGTK.c new file mode 100644 index 000000000..ede4aa03f --- /dev/null +++ b/helm/helmpot/guiGTK.c @@ -0,0 +1,577 @@ +/* + * Copyright (C) 2000, Luca Padovani . + * + * This file is part of HelmPot, a minimal browser for HELM. + * + * HelmPot is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HelmPot 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HelmPot; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, see the HelmPot World-Wide-Web page, + * http://cs.unibo.it/helm/helmview, or send a mail to + * + */ + +#include + +#include +#include +#include +#include +#if HAVE_UNISTD_H +# include +# include +# include +# include +#endif +#include +#include + +#include "gtkmathview.h" +#include "guiGTK.h" + +#define XLINK_NS_URI "http://www.w3.org/1999/xlink" + +#define pot_width 16 +#define pot_height 16 +PRIVATE unsigned char pot_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x07, + 0x00, 0x00, 0xe6, 0x2f, 0x34, 0x5f, 0xdc, 0x5f, 0xf8, 0x3f, 0xf8, 0x3f, + 0xf0, 0x1f, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00}; + +#define pot_mask_width 16 +#define pot_mask_height 16 +static unsigned char pot_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xe0, 0x0f, 0xe0, 0x0f, + 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, + 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x1f, 0x00, 0x00}; + +PRIVATE GtkWidget* window; +PRIVATE GtkWidget* main_area; +PRIVATE GtkWidget* scrolled_area; +PRIVATE GtkWidget* status_bar; +PRIVATE GtkMenuItem* kerning_item; +PRIVATE GtkMenuItem* anti_aliasing_item; +PRIVATE GtkMenuItem* font_size_item; +PRIVATE gchar* file_name = NULL; + +PRIVATE GdkCursor* pot; + +PRIVATE guint statusbar_context; + +PRIVATE void create_widget_set(void); +PRIVATE GtkWidget* get_main_menu(void); +PRIVATE void options_font_size(GtkWidget*, guint); +PRIVATE void options_font_manager(GtkWidget*, guint); +PRIVATE void options_verbosity(GtkWidget*, guint); +PRIVATE void options_kerning(GtkWidget*, gpointer); +PRIVATE void options_anti_aliasing(GtkWidget*, gpointer); +PRIVATE void help_about(GtkWidget*, gpointer); +PRIVATE void save_as(GtkWidget*); +PRIVATE void export_to_ps(GtkWidget*); + +PRIVATE GtkItemFactoryEntry menu_items[] = { + { "/_File", NULL, NULL, 0, "" }, + { "/File/Save _As...", NULL, save_as, 0, NULL }, + { "/File/_Export to PostScript...", NULL, export_to_ps, 0, NULL }, + { "/File/sep1", NULL, NULL, 0, "" }, + { "/File/_Quit", "Q", gtk_main_quit, 0, NULL }, + + { "/_Options", NULL, NULL, 0, "" }, + { "/Options/Default _Font Size", NULL, NULL, 0, "" }, + { "/Options/Default Font Size/8pt", NULL, options_font_size, 8, "" }, + { "/Options/Default Font Size/10pt", NULL, options_font_size, 10, "/Options/Default Font Size/8pt" }, + { "/Options/Default Font Size/12pt", NULL, options_font_size, 12, "/Options/Default Font Size/8pt" }, + { "/Options/Default Font Size/14pt", NULL, options_font_size, 14, "/Options/Default Font Size/8pt" }, + { "/Options/Default Font Size/18pt", NULL, options_font_size, 18, "/Options/Default Font Size/8pt" }, + { "/Options/Default Font Size/24pt", NULL, options_font_size, 24, "/Options/Default Font Size/8pt" }, + { "/Options/Font Manager", NULL, NULL, 0, "" }, + { "/Options/Font Manager/_GTK", NULL, options_font_manager, 0, "" }, + { "/Options/Font Manager/_Type 1", NULL, options_font_manager, 1, "/Options/Font Manager/GTK" }, + { "/Options/Verbosity", NULL, NULL, 0, "" }, + { "/Options/Verbosity/_Errors", NULL, options_verbosity, 0, "" }, + { "/Options/Verbosity/_Warnings", NULL, options_verbosity, 1, "/Options/Verbosity/Errors" }, + { "/Options/Verbosity/_Info", NULL, options_verbosity, 2, "/Options/Verbosity/Errors" }, + { "/Options/Verbosity/_Debug", NULL, options_verbosity, 3, "/Options/Verbosity/Errors" }, + { "/Options/sep1", NULL, NULL, 0, "" }, + { "/Options/_Kerning", NULL, options_kerning, 0, "" }, + { "/Options/_Anti Aliasing", NULL, options_anti_aliasing, 0, "" }, + + { "/_Help" , NULL, NULL, 0, "" }, + { "/Help/About...", NULL, help_about, 0, NULL } +}; + +PRIVATE void +quick_message(const gchar* msg) +{ + GtkWidget* dialog; + GtkWidget* label; + GtkWidget* okay_button; + + /* Create the widgets */ + + dialog = gtk_dialog_new(); + label = gtk_label_new (msg); + okay_button = gtk_button_new_with_label("OK"); + + gtk_widget_set_usize(dialog, 300, 100); + + /* Ensure that the dialog box is destroyed when the user clicks ok. */ + + gtk_signal_connect_object (GTK_OBJECT (okay_button), "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), GTK_OBJECT(dialog)); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->action_area), + okay_button); + + /* Add the label, and show everything we've added to the dialog. */ + + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), label); + gtk_widget_show_all (dialog); +} + +PRIVATE void +load_error_msg(const gchar* name) +{ + gchar* msg = g_strdup_printf("Could not load\n`%s'", name); + quick_message(msg); + g_free(msg); +} + +PRIVATE void +save_error_msg(const gchar* name) +{ + gchar* msg = g_strdup_printf("Could not save\n`%s'", name); + quick_message(msg); + g_free(msg); +} + +void +GUI_init(gint* argc, gchar*** argv, gchar* title, guint width, guint height, GtkFunction f, guint32 timeout) +{ + GdkPixmap* source; + GdkPixmap* mask; + + GdkColor fg = { 0, 65535, 65535, 65535 }; + GdkColor bg = { 0, 0, 0, 0 }; + + gtk_init(argc, argv); + + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_title(GTK_WINDOW(window), title); + gtk_window_set_default_size(GTK_WINDOW(window), width, height); + gtk_signal_connect(GTK_OBJECT(window), "delete_event", (GtkSignalFunc) gtk_main_quit, NULL); + create_widget_set(); + + gtk_widget_show(window); + + gtk_timeout_add(timeout, f, NULL); + + source = gdk_bitmap_create_from_data (NULL, pot_bits, + pot_width, pot_height); + mask = gdk_bitmap_create_from_data (NULL, pot_mask_bits, + pot_mask_width, pot_mask_height); + pot = gdk_cursor_new_from_pixmap (source, mask, &fg, &bg, 8, 8); + gdk_pixmap_unref (source); + gdk_pixmap_unref (mask); +} + +void +GUI_uninit() +{ +} + +int +GUI_load_document(const gchar* name) +{ + GtkMathView* math_view; + GtkMathViewClass* klass; + + g_return_val_if_fail(name != NULL, -1); + g_return_val_if_fail(main_area != NULL, -1); + g_return_val_if_fail(GTK_IS_MATH_VIEW(main_area), -1); + + math_view = GTK_MATH_VIEW(main_area); + g_return_val_if_fail(math_view != NULL, -1); + + klass = (GtkMathViewClass*) gtk_type_class(gtk_math_view_get_type()); + g_return_val_if_fail(klass != NULL, -1); + + gdk_window_set_cursor (main_area->window, pot); + + if (!gtk_math_view_load(math_view, name)) { + load_error_msg(name); + return -1; + } + + gtk_statusbar_pop(GTK_STATUSBAR(status_bar), statusbar_context); + if (strlen(name) > 40) name += strlen(name) - 40; + gtk_statusbar_push(GTK_STATUSBAR(status_bar), statusbar_context, name); + + gdk_window_set_cursor(main_area->window, klass->normal_cursor); + + if (file_name != NULL) g_free(file_name); + file_name = g_strdup(name); + + return 0; +} + +void +GUI_unload_document() +{ + GtkMathView* math_view; + + g_return_if_fail(main_area != NULL); + g_return_if_fail(GTK_IS_MATH_VIEW(main_area)); + + math_view = GTK_MATH_VIEW(main_area); + + gtk_math_view_unload(math_view); +} + +void +GUI_run() +{ + gtk_main(); +} + +PRIVATE void +options_font_size(GtkWidget* widget, guint size) +{ + GtkMathView* math_view; + + g_return_if_fail(main_area != NULL); + g_return_if_fail(GTK_IS_MATH_VIEW(main_area)); + + math_view = GTK_MATH_VIEW(main_area); + + gtk_math_view_set_font_size(math_view, size); +} + +PRIVATE void +options_font_manager(GtkWidget* widget, guint id) +{ + GtkMathView* math_view; + + g_return_if_fail(main_area != NULL); + g_return_if_fail(GTK_IS_MATH_VIEW(main_area)); + + math_view = GTK_MATH_VIEW(main_area); + + gtk_math_view_set_font_manager_type(math_view, id); +} + +PRIVATE void +options_anti_aliasing(GtkWidget* widget, gpointer data) +{ + gboolean aa = gtk_math_view_get_anti_aliasing(GTK_MATH_VIEW(main_area)); + gtk_math_view_set_anti_aliasing(GTK_MATH_VIEW(main_area), !aa); +} + +PRIVATE void +options_kerning(GtkWidget* widget, gpointer data) +{ + gboolean k = gtk_math_view_get_kerning(GTK_MATH_VIEW(main_area)); + gtk_math_view_set_kerning(GTK_MATH_VIEW(main_area), !k); +} + +PRIVATE void +options_verbosity(GtkWidget* widget, guint level) +{ + gtk_math_view_set_log_verbosity(GTK_MATH_VIEW(main_area), level); +} + +PRIVATE void +help_about(GtkWidget* widget, gpointer data) +{ + GtkWidget* dialog; + GtkWidget* label; + GtkWidget* ok; + + dialog = gtk_dialog_new(); + label = gtk_label_new("\n HELM PoT \n Copyright (C) 2001 Luca Padovani \n"); + ok = gtk_button_new_with_label("Close"); + + gtk_signal_connect_object (GTK_OBJECT (ok), "clicked", + GTK_SIGNAL_FUNC (gtk_widget_destroy), (gpointer) dialog); + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->action_area), + ok); + + gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), label); + + gtk_widget_show_all (dialog); +} + +PRIVATE void +export_filename(GtkFileSelection* selector, gpointer user_data) +{ + FILE* f; + GtkMathView* math_view; + gchar* selected_filename; + + selected_filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION(user_data)); + + math_view = GTK_MATH_VIEW(main_area); + + f = fopen(selected_filename, "wt"); + if (f == NULL) { + save_error_msg(selected_filename); + /*g_free(selected_filename);*/ + return; + } + + gtk_math_view_export_to_postscript(math_view, + (21 * SCALED_POINTS_PER_CM) / SCALED_POINTS_PER_PX, + (29 * SCALED_POINTS_PER_CM) / SCALED_POINTS_PER_PX, + SCALED_POINTS_PER_IN / SCALED_POINTS_PER_PX, + SCALED_POINTS_PER_IN / SCALED_POINTS_PER_PX, + FALSE, + f); + + fclose(f); + /*g_free(selected_filename);*/ +} + +PRIVATE void +save_filename(GtkFileSelection* selector, gpointer user_data) +{ + FILE* source; + FILE* dest; + gchar* buffer; + gchar* selected_filename; + + if (file_name == NULL) return; + + source = fopen(file_name, "rt"); + if (source == NULL) { + load_error_msg(file_name); + return; + } + + selected_filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION(user_data)); + if (selected_filename == NULL) return; + + dest = fopen(selected_filename, "wt"); + if (dest == NULL) { + save_error_msg(selected_filename); + /*g_free(selected_filename);*/ + return; + } + + /*g_free(selected_filename);*/ + + buffer = g_new(gchar, 2048); + while (!feof(source)) { + size_t n = fread(buffer, sizeof(gchar), 2048, source); + fwrite(buffer, sizeof(gchar), n, dest); + } + + g_free(buffer); + fclose(source); + fclose(dest); +} + +PRIVATE void +file_dialog(const gchar* title, GtkSignalFunc f) +{ + GtkWidget* fs; + + g_return_if_fail(title != NULL); + g_return_if_fail(f != NULL); + + fs = gtk_file_selection_new(title); + + gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(fs)->ok_button), + "clicked", f, fs); + + /* Ensure that the dialog box is destroyed when the user clicks a button. */ + + gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(fs)->ok_button), + "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), + (gpointer) fs); + + gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(fs)->cancel_button), + "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy), + (gpointer) fs); + + /* Display that dialog */ + + gtk_widget_show (fs); +} + +PRIVATE void +export_to_ps(GtkWidget* widget) +{ + file_dialog("Export to PostScript", export_filename); +#if 0 + static GList* items = NULL; + + GtkWidget* dialog; + GtkWidget* tmp; + + if (items == NULL) { + items = g_list_append(items, "A4"); + items = g_list_append(items, "A5"); + } + + dialog = gtk_dialog_new(); + tmp = gtk_label_new("Paper size"); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), tmp); + tmp = gtk_combo_new(); + gtk_combo_set_popdown_strings(GTK_COMBO(tmp), items); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), tmp); +#if 0 + tmp = gtk_check_button_new_with_label("Disable Colors"); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), tmp); +#endif + + tmp = gtk_button_new_with_label("OK"); + gtk_signal_connect_object(GTK_OBJECT(tmp), "clicked", GTK_SIGNAL_FUNC(export_to_ps_get_file_name), dialog); + gtk_signal_connect_object(GTK_OBJECT(tmp), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), dialog); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), tmp); + tmp = gtk_button_new_with_label("Cancel"); + gtk_signal_connect_object(GTK_OBJECT(tmp), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), dialog); + gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->action_area), tmp); + + gtk_widget_show_all(dialog); +#endif +} + +PRIVATE void +save_as(GtkWidget* widget) +{ + file_dialog("Save As...", save_filename); +} + +PRIVATE void +selection_changed(GtkMathView* math_view, mDOMNodeRef node) +{ + g_return_if_fail(math_view != NULL); + g_return_if_fail(GTK_IS_MATH_VIEW(math_view)); + gtk_math_view_set_selection(math_view, node); +} + +PRIVATE void +jump(GtkMathView* math_view, mDOMNodeRef node) +{ + mDOMStringRef href; + + g_return_if_fail(node != NULL); + href = mdom_node_get_attribute_ns(node, DOM_CONST_STRING("href"), XLINK_NS_URI); + + if (href != NULL) { + pid_t pid; + + g_assert(main_area != NULL); + gdk_window_set_cursor (main_area->window, pot); + + pid = fork(); + if (pid == -1) exit(-1); + if (pid == 0) { + gchar* open_url = g_strdup_printf("openURL(%s,cic)", href); + gint fd; + + close(0); + close(1); + close(2); + + fd = open("/dev/null", O_RDWR); + dup(fd); + dup(fd); + + execlp("netscape", "netscape", "-noraise", "-remote", open_url, NULL); + perror("exec failed:"); + exit(-1); + } + mdom_string_free(href); + } +} + +PRIVATE void +create_widget_set() +{ + GtkWidget* main_vbox; + GtkWidget* menu_bar; + + main_vbox = gtk_vbox_new(FALSE, 1); + gtk_container_border_width(GTK_CONTAINER(main_vbox), 1); + gtk_container_add(GTK_CONTAINER(window), main_vbox); + gtk_widget_show(main_vbox); + + menu_bar = get_main_menu(); + gtk_box_pack_start(GTK_BOX(main_vbox), menu_bar, FALSE, TRUE, 0); + gtk_widget_show(menu_bar); + + main_area = gtk_math_view_new(NULL, NULL); + gtk_widget_show(main_area); + + gtk_signal_connect_object (GTK_OBJECT (main_area), + "selection_changed", GTK_SIGNAL_FUNC (selection_changed), + (gpointer) main_area); + + gtk_signal_connect_object (GTK_OBJECT (main_area), "jump", GTK_SIGNAL_FUNC(jump), NULL); + + scrolled_area = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_area), + GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); + gtk_widget_show(scrolled_area); + gtk_container_add(GTK_CONTAINER(scrolled_area), main_area); + gtk_box_pack_start(GTK_BOX(main_vbox), scrolled_area, TRUE, TRUE, 0); + + status_bar = gtk_statusbar_new(); + gtk_widget_show(status_bar); + gtk_box_pack_start(GTK_BOX(main_vbox), status_bar, FALSE, TRUE, 0); + statusbar_context = gtk_statusbar_get_context_id(GTK_STATUSBAR(status_bar), "filename"); + + gtk_widget_show(main_vbox); + + if (gtk_math_view_get_anti_aliasing(GTK_MATH_VIEW(main_area))) + gtk_menu_item_activate(anti_aliasing_item); + + if (gtk_math_view_get_kerning(GTK_MATH_VIEW(main_area))) + gtk_menu_item_activate(kerning_item); + + gtk_math_view_set_font_size(GTK_MATH_VIEW(main_area), DEFAULT_FONT_SIZE); + gtk_menu_item_activate(font_size_item); +} + +GtkWidget* +get_main_menu() +{ + GtkItemFactory* item_factory; + GtkAccelGroup* accel_group; + GtkWidget* menu_item; + + gint nmenu_items = sizeof(menu_items) / sizeof(menu_items[0]); + + accel_group = gtk_accel_group_new(); + + item_factory = gtk_item_factory_new(GTK_TYPE_MENU_BAR, "
", accel_group); + + gtk_item_factory_create_items(item_factory, nmenu_items, menu_items, NULL); + + gtk_window_add_accel_group(GTK_WINDOW(window), accel_group); + + menu_item = gtk_item_factory_get_widget(item_factory, "/Options/Kerning"); + kerning_item = GTK_MENU_ITEM(menu_item); + + menu_item = gtk_item_factory_get_widget(item_factory, "/Options/Anti Aliasing"); + anti_aliasing_item = GTK_MENU_ITEM(menu_item); + + /* !!!BEWARE!!! the default font size must be kept aligned with the definition + * in defs.h + */ + menu_item = gtk_item_factory_get_widget(item_factory, "/Options/Default Font Size/14pt"); + font_size_item = GTK_MENU_ITEM(menu_item); + + return gtk_item_factory_get_widget(item_factory, "
"); +} diff --git a/helm/helmpot/guiGTK.h b/helm/helmpot/guiGTK.h new file mode 100644 index 000000000..83f5f866a --- /dev/null +++ b/helm/helmpot/guiGTK.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2000, Luca Padovani . + * + * This file is part of HelmPot, a minimal browser for HELM. + * + * HelmPot is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HelmPot 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HelmPot; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, see the HelmPot World-Wide-Web page, + * http://cs.unibo.it/helm/helmview, or send a mail to + * + */ + +#ifndef __guiGTK_h__ +#define __guiGTK_h__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + /* initGUI: some initialization stuff, creates the main window, sets it with a title */ + void GUI_init(gint *, gchar ***, gchar *, guint, guint, GtkFunction, guint32); + void GUI_uninit(void); + + int GUI_load_document(const gchar*); + void GUI_unload_document(void); + void GUI_dump_entities(void); + + /* main: this is the main event loop, to be called when the program is ready to run */ + void GUI_run(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __guiGTK_h__ */ diff --git a/helm/helmpot/helmpot.spec.in b/helm/helmpot/helmpot.spec.in new file mode 100644 index 000000000..641f1849f --- /dev/null +++ b/helm/helmpot/helmpot.spec.in @@ -0,0 +1,24 @@ +Summary: A minimal browser for the HELM library +Name: @PACKAGE@ +Version: @VERSION@ +Release: 1 +Copyright: GPL +Group: Development/Libraries +Source: www.cs.unibo.it:/helm/helmpot/@PACKAGE@-@VERSION@.tar.gz +%description +HelmView is a minimal browser for the HELM library. + +%prep +%setup + +%build +./configure +make + +%install +make install + +%files +%doc AUTHORS COPYING ChangeLog INSTALL LICENSE NEWS README TODO + +/usr/local/bin/@PACKAGE@ diff --git a/helm/helmpot/main.c b/helm/helmpot/main.c new file mode 100644 index 000000000..f99e2fa3b --- /dev/null +++ b/helm/helmpot/main.c @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2000, Luca Padovani . + * + * This file is part of HelmPot, a minimal browser for HELM. + * + * HelmPot is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * HelmPot 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with HelmPot; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * For details, see the HelmPot World-Wide-Web page, + * http://cs.unibo.it/helm/helmview, or send a mail to + * + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "defs.h" +#include "guiGTK.h" + +#define BUFFER_SIZE 2048 + +PRIVATE gchar app_name[64]; +PRIVATE gint sockfd; +PRIVATE struct sockaddr_in address; + +PRIVATE void +error(const gchar* msg) +{ + g_assert(msg != NULL); + fprintf(stderr, "%s: fatal error: %s\n", app_name, msg); +} + +#if 0 +PRIVATE void +print_version() +{ + printf("%s - written by Luca Padovani (C) 2000.\n", app_name); +#ifdef DEBUG + printf("Compiled %s %s\n", __DATE__, __TIME__); +#endif + exit(0); +} +#endif + +PRIVATE gboolean +timeout(gpointer user_data) +{ + static gchar file_name[BUFFER_SIZE]; + + if (recv(sockfd, file_name, BUFFER_SIZE, 0) < 0) { + if (errno != EAGAIN && errno != EWOULDBLOCK) + error("error receving message"); + } else + GUI_load_document(file_name); + + return TRUE; +} + +int +main(int argc, char *argv[]) +{ + sprintf(app_name, "HELM Pot (Plug-OuT) v%s", VERSION); + + if (argc != 2) { + fprintf(stderr, "%s\n\n", app_name); + fprintf(stderr, "Usage: helmpot URL\n"); + exit(-1); + } + + sockfd = socket(PF_INET, SOCK_DGRAM, 0); + if (sockfd < 0) error("could not create socket"); + + if (inet_aton("127.0.0.1", &address.sin_addr) < 0) + error("could not create address"); + address.sin_port = 8778; + address.sin_family = PF_INET; + + if (bind(sockfd, &address, sizeof(address)) < 0) { + if (sendto(sockfd, argv[1], strlen(argv[1]), 0, &address, sizeof(address)) < 0) + error("could not send message"); + sleep(1); + exit(0); + } + + if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0) + error("could not set the socket to non-block mode"); + + GUI_init(&argc, &argv, app_name, 500, 600, timeout, 500); + + GUI_load_document(argv[1]); + + GUI_run(); + GUI_uninit(); + GUI_unload_document(); + + return 0; +} diff --git a/helm/helmpot/pot_mask b/helm/helmpot/pot_mask new file mode 100644 index 000000000..09f71a6a9 --- /dev/null +++ b/helm/helmpot/pot_mask @@ -0,0 +1,6 @@ +#define pot_mask_width 16 +#define pot_mask_height 16 +static unsigned char pot_mask_bits[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0xe0, 0x0f, 0xe0, 0x0f, + 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xfe, 0xff, 0xfc, 0x7f, + 0xfc, 0x7f, 0xf8, 0x3f, 0xf0, 0x1f, 0x00, 0x00}; diff --git a/helm/on-line/html/control.html b/helm/on-line/html/control.html new file mode 100644 index 000000000..6e8662db8 --- /dev/null +++ b/helm/on-line/html/control.html @@ -0,0 +1,119 @@ + + + +On-Line Library Configuration + + + + + + + + + + + + +
On-Line Library Configuration
+ +
+ +
+The on-line interface will use a +Getter to locate and +download documents and an +UWOBO to apply transformations +to them. + + +

+ +Here you can choose the Getter and the UWOBO to use, providing valid URLs +to instances of them. + +

+ +To control the behaviour of them, use the apposite +Getter panel +and +UWOBO panel. + +

+ + + + + + + + + + +
UWOBO URL
+
+ +
+
+
+ +
+
+
+ +
+
+ +
+ + + + + + + + + + +
Getter URL
+
+ +
+
+
+ +
+
+
+ +
+
+
+ + + + + diff --git a/helm/on-line/html/index.html b/helm/on-line/html/index.html new file mode 100644 index 000000000..caeebcf24 --- /dev/null +++ b/helm/on-line/html/index.html @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/helm/on-line/html/library/control.html b/helm/on-line/html/library/control.html new file mode 100644 index 000000000..8450f3244 --- /dev/null +++ b/helm/on-line/html/library/control.html @@ -0,0 +1,91 @@ + + + +Control panel + + + + + +
+ + + + + + + + + + + +
+ Format: + + + + + + +
+ (do it also before attempting to take a link to the current page) + +
+ + + +
+
+
+ + diff --git a/helm/on-line/html/library/header.html b/helm/on-line/html/library/header.html new file mode 100644 index 000000000..a1dcbdab7 --- /dev/null +++ b/helm/on-line/html/library/header.html @@ -0,0 +1,18 @@ + + + +Control panel + + + + + + +
+ Index of +
+
+ + diff --git a/helm/on-line/html/library/index.html b/helm/on-line/html/library/index.html new file mode 100644 index 000000000..fb9afb3e4 --- /dev/null +++ b/helm/on-line/html/library/index.html @@ -0,0 +1,60 @@ + + + + + + Index</script> + + + + diff --git a/helm/on-line/html/welcome.html b/helm/on-line/html/welcome.html new file mode 100644 index 000000000..f6fbed438 --- /dev/null +++ b/helm/on-line/html/welcome.html @@ -0,0 +1,6 @@ + + + + + + diff --git a/helm/on-line/icons/back.gif b/helm/on-line/icons/back.gif new file mode 100644 index 000000000..a694ae1ec Binary files /dev/null and b/helm/on-line/icons/back.gif differ diff --git a/helm/on-line/icons/folder.gif b/helm/on-line/icons/folder.gif new file mode 100644 index 000000000..48264601a Binary files /dev/null and b/helm/on-line/icons/folder.gif differ diff --git a/helm/on-line/icons/generic.red.gif b/helm/on-line/icons/generic.red.gif new file mode 100644 index 000000000..94743981d Binary files /dev/null and b/helm/on-line/icons/generic.red.gif differ diff --git a/helm/on-line/javascript/.cvsignore b/helm/on-line/javascript/.cvsignore new file mode 100644 index 000000000..e268d4aeb --- /dev/null +++ b/helm/on-line/javascript/.cvsignore @@ -0,0 +1 @@ +*.js_xml diff --git a/helm/on-line/javascript/Makefile b/helm/on-line/javascript/Makefile new file mode 100644 index 000000000..a2e28081b --- /dev/null +++ b/helm/on-line/javascript/Makefile @@ -0,0 +1,19 @@ + +TARGETS = control.js_xml defaults.js_xml utils.js_xml + +.SUFFIXES: +.SUFFIXES: .js .js_xml + +.js.js_xml: + @echo "" >$@ + @echo "" >>$@ + +all: $(TARGETS) + +clean: + rm -rf $(TARGETS) + diff --git a/helm/on-line/javascript/control.js b/helm/on-line/javascript/control.js new file mode 100644 index 000000000..66412aa9c --- /dev/null +++ b/helm/on-line/javascript/control.js @@ -0,0 +1,138 @@ + +function updateMode(i, s) +{ + var mode = top.mode; + var mode_list = mode.split(","); + var res = ""; + var j; + + for (j = 0; j < mode_list.length; j++) { + if (j == i) res += s; + else res += mode_list[j]; + if (j < mode_list.length - 1) res += ","; + } + + top.mode = res; +} + +function updateOutput(output,format) +{ + var theoryuri = top.theoryuri; + var cicuri = top.cicuri; + var mode = top.mode; + var topurl = top.topurl; + var processorURL = top.processorURL; + var getterURL = top.getterURL; + var mode_list = mode.split(","); + var new_mode = output.options[output.selectedIndex].value; + var dest = "?theoryuri=" + theoryuri + "&cicuri=" + cicuri + "&topurl=" + topurl + "&processorURL=" + processorURL + "&getterURL=" + getterURL + "&mode="; + + if (new_mode != mode_list[0]) { + updateMode(0, new_mode); + if (new_mode == "raw") updateMode(2, format.options[format.selectedIndex].value); + else updateMode(1, format.options[format.selectedIndex].value); + location.search = dest + top.mode; + } +} + +function updateFormat(format) +{ + var mode = top.mode; + var mode_list = mode.split(","); + + if (mode_list[0] == "raw") { + updateMode(1, format.options[format.selectedIndex].value); + } else { + updateMode(2, format.options[format.selectedIndex].value); + } + + refreshReload(); +} + +function updateNatural(checkbox) +{ + if (checkbox.checked) updateMode(3, "yes"); + else updateMode(3, "no"); + refreshReload(); +} + +function updateAnnotations(checkbox) +{ + if (checkbox.checked) updateMode(4, "yes"); + else updateMode(4, "no"); + refreshReload(); +} + +function refreshReload() +{ + var search = + "?mode=" + top.mode + + "&cicuri=" + top.cicuri + + "&theoryuri=" + top.theoryuri + + "&processorURL=" + top.processorURL + + "&getterURL=" + top.getterURL; + + top.frames[0].document.links[0].search = search; + top.frames[0].document.links[1].search = search; + + return true; +} + +function refreshcicHeader(headerURL) +{ + top.cicheader.location.search = "?keys=GP&xmluri=" + headerURL + "¶m.uri=" + top.cicuri; + return true; +} + +function refreshtheoryHeader(headerURL) +{ + top.theoryheader.location.search = "?keys=GP&xmluri=" + headerURL + "¶m.uri=" + top.theoryuri; + return true; +} + +function makeURL(type,uri,cicflags,typesflags) +{ + var mode = top.mode; + var processorURL = top.processorURL; + var getterURL = top.getterURL; + var mode_list = mode.split(","); + + var keys = ""; + var url = ""; + + var output = mode_list[0]; + var format; + if (output == "raw") format = mode_list[1]; + else format = mode_list[2]; + + if (output == "raw") { + url = getterURL + "get?uri=" + uri; + } else { + if (format == "html" && type == "cic") { + keys = "C1,HC2¶m.processorURL=" + escape(processorURL) + + "¶m.getterURL=" + escape(getterURL) + + "¶m.keys=" + escape("C1,HC2"); + } else if (format == "html" && type == "theory") { + keys = "T1,T2,E¶m.processorURL=" + escape(processorURL) + + "¶m.getterURL=" + escape(getterURL) + + "¶m.keys=" + escape("C1,HC2"); + } else if (format == "mml_cont" && type == "cic") { + keys = "C1"; + } else if (format == "mml_cont" && type == "theory") { + keys = "T1,E¶m.keys=C1"; + } else if (format == "mml_pres" && type == "cic") { + keys = "C1,C2"; + } else if (format == "mml_pres" && type == "theory") { + keys = "T1,T2,E¶m.keys=C1,C2"; + } + + var naturalLanguage = typesflags; + if (typesflags != "NO" || type == "theory") { + naturalLanguage = mode_list[3]; + } + url = processorURL + "apply?xmluri=" + escape(getterURL + "get?uri=" + uri) + "&keys=" + keys + "¶m.CICURI=" + uri + "¶m.naturalLanguage=" + naturalLanguage; + } + + return url; +} + diff --git a/helm/on-line/javascript/defaults.js b/helm/on-line/javascript/defaults.js new file mode 100644 index 000000000..f6abf7f87 --- /dev/null +++ b/helm/on-line/javascript/defaults.js @@ -0,0 +1,19 @@ + +function getDefaultParam(name) +{ + switch (name) { + case "processorURL": + return "http://phd.cs.unibo.it:8080/helm/servlet/uwobo/"; + case "getterURL": + return "http://phd.cs.unibo.it:8081/"; + case "cicuri": + return "cic:/"; + case "theoryuri": + return "theory:/"; + case "mode": + return "processed,cic,html,yes,no"; + } + + return "???"; +} + diff --git a/helm/on-line/javascript/prelude.js b/helm/on-line/javascript/prelude.js new file mode 100644 index 000000000..dff8c31fa --- /dev/null +++ b/helm/on-line/javascript/prelude.js @@ -0,0 +1,91 @@ + +function getInitialProcessorURL() +{ + var search = top.location.search; + search = search.slice(1); + var args = search.split("&"); + var processorURL = "-1"; + for (var i = 0 ; i < args.length ; i++) { + var couple = args[i].split("="); + if (couple[0] == "processorURL") processorURL = couple[1]; + } + if (processorURL == "-1") processorURL = getDefaultParam("processorURL"); + return processorURL; +} + +function getInitialGetterURL() +{ + var search = top.location.search; + search = search.slice(1); + var args = search.split("&"); + var getterURL = "-1"; + for (var i = 0 ; i < args.length ; i++) { + var couple = args[i].split("="); + if (couple[0] == "getterURL") getterURL = couple[1]; + } + if (getterURL == "-1") getterURL = getDefaultParam("getterURL"); + return getterURL; +} + +function getUwoboURL() +{ + return document.uwoboURL.elements[0].value; +} + +function getGetterURL() +{ + return document.getterURL.elements[0].value; +} + +function refreshLinks() +{ + var search = top.location.search; + search = search.slice(1); + var args = search.split("&"); + var cicuri = "-1", theoryuri = "-1", mode = "-1"; + for (var i = 0 ; i < args.length ; i++) { + var couple = args[i].split("="); + switch (couple[0]) { + case "cicuri" : cicuri =couple[1]; break; + case "theoryuri" : theoryicuri =couple[1]; break; + case "mode" : mode =couple[1]; break; + } + } + if (cicuri == "-1") cicuri = getDefaultParam("cicuri"); + if (theoryuri == "-1") theoryuri = getDefaultParam("theoryuri"); + if (mode == "-1") mode = getDefaultParam("mode"); + + document.links[2].search = "?getterURL=" + getGetterURL(); + + document.links[3].search = + "?processorURL=" + getUwoboURL() + + "&getterURL=" + getGetterURL(); + + document.links[4].href = "../html/library/index.html?cicuri=" + cicuri + + "&theoryuri=" + theoryuri + + "&mode=" + mode + + "&processorURL=" + getUwoboURL() + + "&getterURL=" + getGetterURL(); +} + +function selectUwoboURL(ss) +{ + if (ss.selectedIndex == 0) { + document.uwoboURL.elements[0].value = ""; + } else { + document.uwoboURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":8080/helm/servlet/uwobo/"; + } + + refreshLink(); +} + +function selectGetterURL(ss) +{ + if (ss.selectedIndex == 0) { + document.getterURL.elements[0].value = ""; + } else { + document.getterURL.elements[0].value = "http://" + ss.options[ss.selectedIndex].value + ":8081/"; + } + + refreshLink(); +} diff --git a/helm/on-line/javascript/utils.js b/helm/on-line/javascript/utils.js new file mode 100644 index 000000000..7a52b7cbe --- /dev/null +++ b/helm/on-line/javascript/utils.js @@ -0,0 +1,36 @@ +function chopSlash(url) +{ + return url.slice(0,url.lastIndexOf('/')); +} + +function getParam(name) +{ + var search = location.search; + search = search.slice(1); + var args = search.split("&"); + var value = "???"; + + for (var i = 0 ; i < args.length ; i++) { + var couple = args[i].split("="); + if (couple[0] == name) value = couple[1]; + } + + if (value == "???") value = getDefaultParam(name); + + return value; +} + +function outputOption(doc, value, content, selected) +{ + doc.write(""); +} + +function outputCheckbox(doc, onclick, content, checked) +{ + doc.write("" + content + ""); +} + diff --git a/helm/on-line/xslt/getParam.xsl b/helm/on-line/xslt/getParam.xsl new file mode 100644 index 000000000..0ec71a869 --- /dev/null +++ b/helm/on-line/xslt/getParam.xsl @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/helm/on-line/xslt/ls2html.xsl b/helm/on-line/xslt/ls2html.xsl new file mode 100644 index 000000000..fc3887719 --- /dev/null +++ b/helm/on-line/xslt/ls2html.xsl @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [{$alt}] + + + + + + + + + + + Index of <xsl:value-of select="$uri"/> + + + + + + + + + + + + + +
+
+ + +
+ + + + + + + + + + + + + + + + + + + + [{@name}] + + + + + + + +
diff --git a/helm/style/config/style-configuration.dtd b/helm/style/config/style-configuration.dtd new file mode 100644 index 000000000..a729aa7d3 --- /dev/null +++ b/helm/style/config/style-configuration.dtd @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/helm/style/config/style-configuration.xml b/helm/style/config/style-configuration.xml new file mode 100644 index 000000000..81518ef14 --- /dev/null +++ b/helm/style/config/style-configuration.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + +