From: Luca Padovani Date: Wed, 10 Jan 2001 10:12:49 +0000 (+0000) Subject: Initial revision X-Git-Tag: nogzip~4 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=dfb99fda45c1cd87a7c2fedcebb987f3220e0516;p=helm.git Initial revision --- 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 + +