--- /dev/null
+*.cmi *.cmo *.cmx *.cma *.cmxa *.annot *.a *.o
+aclocal.m4
+autom4te.cache
+configure
+config.status
+config.log
+Makefile
+META
+gtkSourceViewProps.ml
+ogtkSourceViewProps.ml
--- /dev/null
+gSourceView.cmo: ogtkSourceViewProps.cmo gtk_sourceview.cmo gtkSourceView.cmo \
+ gSourceView.cmi
+gSourceView.cmx: ogtkSourceViewProps.cmx gtk_sourceview.cmx gtkSourceView.cmx \
+ gSourceView.cmi
+gtkSourceView.cmo: gtk_sourceview.cmo gtkSourceViewProps.cmo
+gtkSourceView.cmx: gtk_sourceview.cmx gtkSourceViewProps.cmx
+gtkSourceViewProps.cmo: gtk_sourceview.cmo
+gtkSourceViewProps.cmx: gtk_sourceview.cmx
+ogtkSourceViewProps.cmo: gtkSourceViewProps.cmo
+ogtkSourceViewProps.cmx: gtkSourceViewProps.cmx
+gSourceView.cmi: gtk_sourceview.cmo
--- /dev/null
+Acknowledgments:
+* Claudio Sacerdoti Coen, for introducing me to the insane world of binding GTK
+ widgets to OCaml
--- /dev/null
+Stefano Zacchiroli <zack@cs.unibo.it>
--- /dev/null
+
+July 8, 2005
+ First public release (0.0.1) of LablGtkSourceView.
+
--- /dev/null
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 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.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations
+below.
+
+ When we speak of free software, we are referring to freedom of use,
+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 and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it
+becomes a de-facto standard. To achieve this, non-free programs must
+be allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, 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 library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete 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 distribute a copy of this License along with the
+Library.
+
+ 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.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+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 Library, 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 Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+\f
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you 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.
+
+ If distribution of 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 satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at least
+ three years, to give the same user the materials specified in
+ Subsection 6a, above, for a charge no more than the cost of
+ performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be 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.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library 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.
+
+ 9. 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 Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+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 with
+this License.
+\f
+ 11. 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 Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library 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 Library.
+
+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.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library 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.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser 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 Library
+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 Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+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
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "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
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. 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 LIBRARY 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
+LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms
+of the ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library.
+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.
+
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or
+your school, if any, to sign a "copyright disclaimer" for the library,
+if necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James
+ Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
--- /dev/null
+
+lablgtksourceview, OCaml binding for the GtkSourceView text widget
+
+Copyright (C) 2005 Stefano Zacchiroli <zack@cs.unibo.it>
+
+This library is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
--- /dev/null
+requires="lablgtk2"
+version="@VERSION@"
+archive(byte)="@PACKAGE@.cma"
+archive(native)="@PACKAGE@.cmxa"
+linkopts=""
--- /dev/null
+PACKAGE = @PACKAGE@
+VERSION = @VERSION@
+INCLUDEDIR = @OCAML_INCLUDE_DIR@
+PROPCC = @OCAML_LIB_DIR@/lablgtk2/propcc
+DESTDIR =
+NULL =
+C_OBJECTS = ml_gtk_sourceview.o
+ML_OBJECTS = \
+ gtkSourceViewProps.cmo \
+ ogtkSourceViewProps.cmo \
+ gtk_sourceview.cmo \
+ gtkSourceView.cmo \
+ gSourceView.cmo \
+ $(NULL)
+ML_OBJECTS_OPT = $(patsubst %.cmo,%.cmx,$(ML_OBJECTS))
+GENERATED_FILES = gtkSourceViewProps.ml ogtkSourceViewProps.ml
+EXTRA_INST = \
+ META \
+ gSourceView.mli \
+ gSourceView.cmi \
+ gtkSourceView.cmi \
+ gtk_sourceview.cmi \
+ $(NULL)
+DIST_FILES = \
+ Makefile.in \
+ configure \
+ gSourceView.ml \
+ gSourceView.mli \
+ gtkSourceView.ml \
+ gtk_sourceview.ml \
+ ml_gtk_sourceview.c \
+ META.in \
+ .depend \
+ debian/ \
+ test/ \
+ gtkSourceView.props \
+ $(NULL)
+DIST_DIR = $(PACKAGE)-$(VERSION)
+EXTRA_DIST = ACKNOWLEDGEMENTS AUTHORS CHANGES COPYING LICENSE NEWS README
+REQUIRES = lablgtk2
+SHARED_LIBS = @GTKSOURCEVIEW_LIBS@
+OCAMLFIND = ocamlfind
+OCAMLC = $(OCAMLFIND) ocamlc -package "$(REQUIRES)"
+OCAMLOPT = $(OCAMLFIND) ocamlopt -package "$(REQUIRES)"
+OCAMLDEP = ocamldep
+OCAMLMKLIB = ocamlmklib
+OCAML_STUB_DIR = @OCAML_STUB_DIR@
+ARCHIVE = $(PACKAGE)
+DLL = dll$(ARCHIVE).so
+NATIVE = @HAVE_OCAMLOPT@
+TESTDIR = test
+BYTE_INST = $(ARCHIVE).cma lib$(ARCHIVE).a $(C_OBJECTS) $(DLL)
+OPT_INST = $(BYTE_INST) $(ARCHIVE).cmxa $(ARCHIVE).a
+
+ifeq ($(NATIVE),yes)
+world: all opt
+else
+world: all
+endif
+
+all: $(ARCHIVE).cma lib$(ARCHIVE).a $(DLL) $(TESTDIR)/test
+opt: $(ARCHIVE).cmxa $(ARCHIVE).a $(TESTDIR)/test.opt
+
+test/test.opt:
+ $(MAKE) -C $(TESTDIR) test.opt
+test/test:
+ $(MAKE) -C $(TESTDIR) test
+
+dist: distclean
+ rm -rf $(DIST_DIR)/
+ mkdir -p $(DIST_DIR)/
+ cp -a $(DIST_FILES) $(EXTRA_DIST) $(DIST_DIR)/
+ -find $(DIST_DIR) -name .svn -type d -exec rm -rf {} \;
+ tar cvfz $(DIST_DIR).tar.gz $(DIST_DIR)/
+ rm -rf $(DIST_DIR)/
+
+deb: dist
+ rm -rf $(DIST_DIR)
+ tar xvzf $(DIST_DIR).tar.gz
+ (cd $(DIST_DIR)/ && debuild)
+ rm -rf $(DIST_DIR)
+
+ml_gtk_sourceview.o: ml_gtk_sourceview.c
+ gcc -c -I$(INCLUDEDIR) -fPIC `$(OCAMLFIND) query -i-format lablgtk2` @GTKSOURCEVIEW_CFLAGS@ $<
+
+%.cmo: %.ml
+ $(OCAMLC) -c $<
+%.cmi: %.mli
+ $(OCAMLC) -c $<
+%.cmx: %.ml
+ $(OCAMLOPT) -c $<
+
+$(GENERATED_FILES): gtkSourceView.props
+%Props.ml o%Props.ml: %.props
+ $(PROPCC) $<
+
+depend: *.ml *.mli $(GENERATED_FILES)
+ $(OCAMLDEP) *.ml *.mli >.depend
+include .depend
+
+$(ARCHIVE).cma: $(ML_OBJECTS)
+ $(OCAMLMKLIB) -o $(ARCHIVE) $^ $(SHARED_LIBS)
+$(ARCHIVE).cmxa: $(ML_OBJECTS_OPT)
+ $(OCAMLMKLIB) -o $(ARCHIVE) $^ $(SHARED_LIBS)
+lib$(ARCHIVE).a $(DLL): $(C_OBJECTS)
+ $(OCAMLMKLIB) -o $(ARCHIVE) $^ $(SHARED_LIBS)
+
+ifeq ($(DESTDIR),"")
+INSTALLER = $(OCAMLFIND) install -ldconf /dev/null
+UNINSTALLER = $(OCAMLFIND) remove -ldconf /dev/null
+else
+INSTALLER = $(OCAMLFIND) install -destdir $(DESTDIR) -ldconf /dev/null
+UNINSTALLER = $(OCAMLFIND) remove -destdir $(DESTDIR) -ldconf /dev/null
+install: world installmkdir
+endif
+
+ifeq ($(NATIVE),yes)
+install: installworld
+else
+install: installbyte
+endif
+
+installbyte:
+ $(INSTALLER) $(PACKAGE) $(BYTE_INST) $(EXTRA_INST)
+installworld:
+ $(INSTALLER) $(PACKAGE) $(OPT_INST) $(EXTRA_INST)
+
+installmkdir:
+ mkdir -p $(DESTDIR)
+
+uninstall:
+ $(UNINSTALLER) $(PACKAGE)
+
+clean:
+ rm -f *.[ao] *.cm[iaxo] *.cmxa *.so $(GENERATED_FILES)
+ make -C $(TESTDIR) clean
+
+distclean: clean
+ rm -f config.log config.cache config.status Makefile META
+ make -C $(TESTDIR) distclean
+
+.PHONY: world uninstall clean distclean test/test test/test.opt
+.PHONY: install installmkdir installbyte installworld
+
--- /dev/null
+
+LablGtkSourceView: OCaml bindings for GtkSourceView
+---------------------------------------------------
+
+LablGtkSourceView are the OCaml bindings for GtkSourceView, a GTK widget
+which extends the standrd GTK text widgets implementing syntax
+highlighting, automatic indentation, and other typical features of
+source editors.
+
+Using LablGtkSourceView you can instantiate and use GtkSourceView
+widgets in OCaml programs which use GTK through the LablGtk interface.
+
+LablGtkSourceView is freely distributed under the term of the GNU LGPL
+(Lesser General Public License), see LICENSE and COPYING files for more
+info.
+
+Requirements
+------------
+
+In order to build LablGtkSourceView from sources you need:
+
+* OCaml (http://caml.inria.fr/)
+* Findlib (http://www.ocaml-programming.de/packages/)
+* LablGTK (http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgtk.html)
+* GtkSourceView (http://gtksourceview.sourceforge.net/)
+
+Once you have installed all of them, follow the usual procedure:
+
+ ./configure
+ make world
+ make install
+
+Availability of ocamlopt is detected by ./configure, if you manually
+want to choose what to build:
+
+ make all # for building the bytecode part of the library
+ make opt # for the native code part
+
+--
+Stefano Zacchiroli
+Sun, 31 Jul 2005 23:50:34 +0200
+
--- /dev/null
+AC_INIT(gSourceView.ml)
+
+PACKAGE="lablgtksourceview"
+
+MAJOR_VERSION="0"
+MINOR_VERSION="0"
+MICRO_VERSION="1"
+VERSION="$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION"
+
+PKG_CHECK_MODULES([GTKSOURCEVIEW], [gtksourceview-1.0 >= 1.2.0])
+
+AC_CHECK_PROG(HAVE_OCAMLFIND, ocamlfind, yes, no)
+if test $HAVE_OCAMLFIND = "no"; then
+ AC_MSG_ERROR(could not find ocamlfind)
+fi
+FINDLIB_REQUIRES="lablgtk2"
+for r in $FINDLIB_REQUIRES
+do
+ AC_MSG_CHECKING(for $r ocaml library)
+ if ocamlfind query $r &> /dev/null; then
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_ERROR(could not find $r ocaml library)
+ fi
+done
+
+AC_MSG_CHECKING(for the ocaml library dir)
+OCAML_LIB_DIR=`ocamlfind ocamlc -where`
+AC_MSG_RESULT($OCAML_LIB_DIR)
+OCAML_STUB_DIR="$OCAML_LIB_DIR/stublibs"
+
+AC_CHECK_FILE(/usr/include/caml/mlvalues.h,
+ OCAML_INCLUDE_DIR=/usr/include/caml,
+ AC_MSG_ERROR(could not find ocaml header files)
+)
+
+AC_CHECK_PROG(HAVE_OCAMLOPT, ocamlopt, yes, no)
+
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+AC_SUBST(GTKSOURCEVIEW_CFLAGS)
+AC_SUBST(GTKSOURCEVIEW_LIBS)
+AC_SUBST(OCAML_LIB_DIR)
+AC_SUBST(OCAML_STUB_DIR)
+AC_SUBST(OCAML_INCLUDE_DIR)
+AC_SUBST(HAVE_OCAMLOPT)
+
+AC_OUTPUT([
+ test/Makefile
+ Makefile
+ META
+])
+
--- /dev/null
+lablgtksourceview (0.0.1-4) unstable; urgency=low
+
+ * Rebuilt with ocaml 3.09.2, bumped deps accordingly.
+ * debian/control
+ - bumped Standards-Version to 3.7.2 (no changes needed)
+
+ -- Stefano Zacchiroli <zack@debian.org> Wed, 17 May 2006 00:11:40 -0500
+
+lablgtksourceview (0.0.1-3) unstable; urgency=low
+
+ * Rebuilt against OCaml 3.09.1, bumped deps accordingly.
+
+ -- Stefano Zacchiroli <zack@debian.org> Sun, 8 Jan 2006 01:30:23 +0100
+
+lablgtksourceview (0.0.1-2) unstable; urgency=low
+
+ * rebuilt with ocaml 3.09
+ * debian/*
+ - no longer hard coding of ocaml abi version anywhere
+
+ -- Stefano Zacchiroli <zack@debian.org> Wed, 23 Nov 2005 10:23:24 +0000
+
+lablgtksourceview (0.0.1-1) unstable; urgency=low
+
+ * Initial release (closes: bug#320716).
+
+ -- Stefano Zacchiroli <zack@debian.org> Mon, 1 Aug 2005 17:57:57 +0200
+
--- /dev/null
+Source: lablgtksourceview
+Section: devel
+Priority: optional
+Maintainer: Stefano Zacchiroli <zack@debian.org>
+Build-Depends: debhelper (>= 4.1.0), cdbs, ocaml-findlib, ocaml-nox (>= 3.09.2), liblablgtk2-ocaml-dev (>= 2.6.0-2), libgtksourceview-dev (>= 1.2.0)
+Standards-Version: 3.7.2
+
+Package: liblablgtksourceview-ocaml-dev
+Architecture: any
+Section: libdevel
+Depends: ocaml-nox-${F:OCamlABI}, ocaml-findlib, liblablgtksourceview-ocaml (= ${Source-Version}), liblablgtk2-ocaml-dev (>= 2.6.0-2), libgtksourceview-dev (>= 1.2.0), ${misc:Depends}
+Description: OCaml bindings for libgtksourceview, a source editor GTK widget
+ This is the OCaml binding for the GtkSourceView widget, a text widget that
+ extends the standard gtk+ 2.x text widget with syntax highlighting and other
+ features typical of a source editor.
+ .
+ This package contains the development part of the lablgtksourceview package.
+
+Package: liblablgtksourceview-ocaml
+Architecture: any
+Section: libs
+Depends: ocaml-base-nox-${F:OCamlABI}, liblablgtk2-ocaml (>= 2.6.0-2), ${shlibs:Depends}, ${misc:Depends}
+Description: OCaml bindings for libgtksourceview, a source editor GTK widget
+ This is the OCaml binding for the GtkSourceView widget, a text widget that
+ extends the standard gtk+ 2.x text widget with syntax highlighting and other
+ features typical of a source editor.
+ .
+ This package contains the shared runtime stub libraries.
+
--- /dev/null
+Source: lablgtksourceview
+Section: devel
+Priority: optional
+Maintainer: Stefano Zacchiroli <zack@debian.org>
+Build-Depends: debhelper (>= 4.1.0), cdbs, ocaml-findlib, ocaml-nox (>= @OCamlABI@), liblablgtk2-ocaml-dev (>= 2.6.0-2), libgtksourceview-dev (>= 1.2.0)
+Standards-Version: 3.7.2
+
+Package: liblablgtksourceview-ocaml-dev
+Architecture: any
+Section: libdevel
+Depends: ocaml-nox-${F:OCamlABI}, ocaml-findlib, liblablgtksourceview-ocaml (= ${Source-Version}), liblablgtk2-ocaml-dev (>= 2.6.0-2), libgtksourceview-dev (>= 1.2.0), ${misc:Depends}
+Description: OCaml bindings for libgtksourceview, a source editor GTK widget
+ This is the OCaml binding for the GtkSourceView widget, a text widget that
+ extends the standard gtk+ 2.x text widget with syntax highlighting and other
+ features typical of a source editor.
+ .
+ This package contains the development part of the lablgtksourceview package.
+
+Package: liblablgtksourceview-ocaml
+Architecture: any
+Section: libs
+Depends: ocaml-base-nox-${F:OCamlABI}, liblablgtk2-ocaml (>= 2.6.0-2), ${shlibs:Depends}, ${misc:Depends}
+Description: OCaml bindings for libgtksourceview, a source editor GTK widget
+ This is the OCaml binding for the GtkSourceView widget, a text widget that
+ extends the standard gtk+ 2.x text widget with syntax highlighting and other
+ features typical of a source editor.
+ .
+ This package contains the shared runtime stub libraries.
+
--- /dev/null
+This package was debianized by Stefano Zacchiroli <zack@debian.org> on
+Sat, 11 Jun 2005 12:19:09 +0200.
+
+It was downloaded from:
+ http://helm.cs.unibo.it/software/lablgtksourceview/
+
+Author:
+ Stefano Zacchiroli <zack@cs.unibo.it>
+
+Copyright:
+
+ lablgtksourceview is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published by the
+ Free Software Foundation; either version 2.1 of the License, or (at your
+ option) any later version.
+
+ On Debian systems a copy of the GNU Lesser General Public License verion 2.1
+ can be found in /usr/share/common-licenses/LGPL-2.1
--- /dev/null
+ACKNOWLEDGEMENTS
+AUTHORS
+README
--- /dev/null
+debian/tmp/lablgtksourceview/*.a usr/lib/ocaml/3.09.2/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.cma usr/lib/ocaml/3.09.2/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.cmi usr/lib/ocaml/3.09.2/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.cmxa usr/lib/ocaml/3.09.2/lablgtksourceview/
+debian/tmp/lablgtksourceview/META usr/lib/ocaml/3.09.2/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.mli usr/lib/ocaml/3.09.2/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.o usr/lib/ocaml/3.09.2/lablgtksourceview/
--- /dev/null
+debian/tmp/lablgtksourceview/*.a usr/lib/ocaml/@OCamlABI@/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.cma usr/lib/ocaml/@OCamlABI@/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.cmi usr/lib/ocaml/@OCamlABI@/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.cmxa usr/lib/ocaml/@OCamlABI@/lablgtksourceview/
+debian/tmp/lablgtksourceview/META usr/lib/ocaml/@OCamlABI@/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.mli usr/lib/ocaml/@OCamlABI@/lablgtksourceview/
+debian/tmp/lablgtksourceview/*.o usr/lib/ocaml/@OCamlABI@/lablgtksourceview/
--- /dev/null
+debian/tmp/lablgtksourceview/*.so usr/lib/ocaml/3.09.2/stublibs/
--- /dev/null
+debian/tmp/lablgtksourceview/*.so usr/lib/ocaml/@OCamlABI@/stublibs/
--- /dev/null
+#!/usr/bin/make -f
+include /usr/share/cdbs/1/rules/debhelper.mk
+include /usr/share/cdbs/1/class/autotools.mk
+
+OCAMLABI := $(shell ocamlc -version)
+OFILES := $(patsubst %.in,%,$(shell ls debian/*.in))
+DEB_DH_GENCONTROL_ARGS = -- -VF:OCamlABI="$(OCAMLABI)"
+
+ocamlinit:
+ for f in $(OFILES); do sed -e 's/@OCamlABI@/$(OCAMLABI)/g' $$f.in > $$f; done
--- /dev/null
+(*
+ * lablgtksourceview, OCaml binding for the GtkSourceView text widget
+ *
+ * Copyright (C) 2005 Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *)
+
+open Gaux
+open Gtk_sourceview
+open Gobject
+open Gtk
+open GtkBase
+open GtkSourceView
+open OgtkSourceViewProps
+open GObj
+
+let get_bool = function `BOOL x -> x | _ -> assert false
+let bool x = `BOOL x
+let get_uint = function `INT x -> x | _ -> assert false
+let uint x = `INT x
+let get_int = function `INT x -> x | _ -> assert false
+let int x = `INT x
+let get_gobject = function `OBJECT x -> x | _ -> assert false
+let gobject x = `OBJECT (Some x)
+
+(** {2 GtkSourceLanguage} *)
+
+class source_language_signals obj' =
+object (self)
+ inherit ['a] gobject_signals (obj' : [> Gtk_sourceview.source_language] obj)
+ inherit source_language_sigs
+end
+
+class source_language (obj: Gtk_sourceview.source_language obj) =
+object (self)
+ method as_source_language = obj
+ method connect = new source_language_signals obj
+ method misc = new gobject_ops obj
+ method get_name = SourceLanguage.get_name obj
+ method get_section = SourceLanguage.get_section obj
+ method get_escape_char = SourceLanguage.get_escape_char obj
+end
+
+(** {2 GtkSourceLanguagesManager} *)
+
+class source_languages_manager
+ (obj: Gtk_sourceview.source_languages_manager obj) =
+object (self)
+ method get_oid = Gobject.get_oid obj
+ method as_source_languages_manager = obj
+ method get_language_from_mime_type s =
+ match SourceLanguagesManager.get_language_from_mime_type obj s with
+ | None -> None
+ | Some obj -> Some (new source_language obj)
+ method lang_files_dirs = SourceLanguagesManager.get_lang_files_dirs obj
+end
+
+(* let source_languages_manager ?lang_files_dirs () =
+ let properties =
+ match lang_files_dirs with
+ | None -> []
+ | Some dirs ->
+ let list_obj = gslist_of_string_list dirs in
+ [Gobject.param
+ "lang-files-dirs"
+ (`OBJECT (Some list_obj))]
+ in
+ new source_languages_manager (SourceLanguagesManager.create properties) *)
+
+let source_languages_manager () =
+ new source_languages_manager (SourceLanguagesManager.create [])
+
+let source_language_from_file ?languages_manager fname =
+ let languages_manager =
+ match languages_manager with
+ | None -> source_languages_manager ()
+ | Some lm -> lm
+ in
+ let manager_obj = languages_manager#as_source_languages_manager in
+ match SourceLanguage.new_from_file fname manager_obj with
+ | None -> None
+ | Some lang_obj -> Some (new source_language lang_obj)
+
+(** {2 GtkSourceBuffer} *)
+
+class source_buffer_signals obj' =
+object
+ inherit ['a] gobject_signals (obj' : [> Gtk_sourceview.source_buffer] obj)
+ inherit GText.buffer_signals obj'
+ inherit source_buffer_sigs
+end
+
+class source_buffer (obj: Gtk_sourceview.source_buffer obj) =
+object (self)
+ inherit GText.buffer_skel obj
+ method connect = new source_buffer_signals obj
+ method misc = new gobject_ops obj
+ method check_brackets = get_bool (self#misc#get_property "check-brackets")
+ method set_check_brackets x = self#misc#set_property "check-brackets" (bool x)
+ method highlight = get_bool (self#misc#get_property "highlight")
+ method set_highlight x = self#misc#set_property "highlight" (bool x)
+ method max_undo_levels = get_int (self#misc#get_property "max-undo-levels")
+ method set_max_undo_levels x =
+ self#misc#set_property "max-undo-levels" (int x)
+ method language =
+ match get_gobject (self#misc#get_property "language") with
+ | None -> None
+ | Some obj ->
+ Some (new source_language (Gobject.try_cast obj "GtkSourceLanguage"))
+ method set_language (x: source_language) =
+ self#misc#set_property "language" (gobject x#as_source_language)
+ method escape_char = get_uint (self#misc#get_property "escape-char")
+ method set_escape_char x = self#misc#set_property "escape-char" (uint x)
+ method can_undo = SourceBuffer.can_undo obj
+ method can_redo = SourceBuffer.can_redo obj
+ method undo () = SourceBuffer.undo obj
+ method redo () = SourceBuffer.redo obj
+ method begin_not_undoable_action () =
+ SourceBuffer.begin_not_undoable_action obj
+ method end_not_undoable_action () =
+ SourceBuffer.end_not_undoable_action obj
+end
+
+let source_buffer ?language ?text (* ?tag_table *) =
+ let language =
+ match language with
+ | None -> None
+ | Some source_language -> Some (source_language#as_source_language)
+ in
+ SourceBuffer.make_params [] ?language ~cont:(fun pl () ->
+ let buf = new source_buffer (SourceBuffer.create pl) in
+ (match text with
+ | None -> ()
+ | Some text -> buf#set_text text);
+ buf)
+
+ (* alias used below, needed because "source_buffer" is a name in scope *)
+let source_buffer' = source_buffer
+
+(** {2 GtkSourceView} *)
+
+class source_view_signals obj' =
+object
+ inherit widget_signals_impl (obj' : [> Gtk_sourceview.source_view] obj)
+ inherit GText.view_signals obj'
+ inherit source_view_sigs
+end
+
+class source_view (obj': Gtk_sourceview.source_view obj) =
+object (self)
+ inherit GText.view_skel obj'
+ val source_buf =
+ let buf_obj =
+ Gobject.try_cast (GtkText.View.get_buffer obj') "GtkSourceBuffer"
+ in
+ new source_buffer buf_obj
+ method source_buffer = source_buf
+ method connect = new source_view_signals obj'
+ method set_show_line_numbers x =
+ self#misc#set_property "show_line_numbers" (bool x)
+ method show_line_numbers =
+ get_bool (self#misc#get_property "show_line_numbers")
+ method set_show_line_markers x =
+ self#misc#set_property "show_line_markers" (bool x)
+ method show_line_markers =
+ get_bool (self#misc#get_property "show_line_markers")
+ method set_tabs_width x = self#misc#set_property "tabs_width" (uint x)
+ method tabs_width = get_uint (self#misc#get_property "tabs_width")
+ method set_auto_indent x = self#misc#set_property "auto_indent" (bool x)
+ method auto_indent = get_bool (self#misc#get_property "auto_indent")
+ method set_insert_spaces_instead_of_tabs x =
+ self#misc#set_property "insert_spaces_instead_of_tabs" (bool x)
+ method insert_spaces_instead_of_tabs =
+ get_bool (self#misc#get_property "insert_spaces_instead_of_tabs")
+ method set_show_margin x = self#misc#set_property "show_margin" (bool x)
+ method show_margin = get_bool (self#misc#get_property "show_margin")
+ method set_margin x = self#misc#set_property "margin" (uint x)
+ method margin = get_uint (self#misc#get_property "margin")
+ method set_smart_home_end x = self#misc#set_property "smart_home_end" (bool x)
+ method smart_home_end = get_bool (self#misc#get_property "smart_home_end")
+end
+
+let source_view ?source_buffer =
+ SourceView.make_params [] ~cont:(
+ GtkText.View.make_params ~cont:(
+ GContainer.pack_container ~create:(fun pl ->
+ let obj =
+ match source_buffer with
+ | Some buf ->
+ SourceView.new_with_buffer
+ (Gobject.try_cast buf#as_buffer "GtkSourceBuffer")
+ | None -> SourceView.new_ ()
+ in
+ Gobject.set_params (Gobject.try_cast obj "GtkSourceView") pl;
+ new source_view obj)))
+
+(** {2 Misc} *)
+
+let find_matching_bracket iter =
+ let iter = iter#copy in
+ if SourceViewMisc.find_matching_bracket iter#as_iter then
+ Some iter
+ else
+ None
+
--- /dev/null
+(*
+ * lablgtksourceview, OCaml binding for the GtkSourceView text widget
+ *
+ * Copyright (C) 2005 Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *)
+
+open Gtk
+
+(** {2 GtkSourceLanguage} *)
+
+class source_language_signals:
+ ([> Gtk_sourceview.source_language ] as 'b) obj ->
+ object ('a)
+ inherit ['b] GObj.gobject_signals
+ method tag_style_changed: callback:(string -> unit) -> GtkSignal.id
+ end
+
+class source_language:
+ Gtk_sourceview.source_language obj ->
+ object
+ method as_source_language: Gtk_sourceview.source_language obj
+ method connect: source_language_signals
+ method get_escape_char: Glib.unichar
+ method get_name: string
+ method get_section: string
+ method misc: GObj.gobject_ops
+ end
+
+(** {2 GtkSourceLanguagesManager} *)
+
+class source_languages_manager:
+ Gtk_sourceview.source_languages_manager obj ->
+ object
+ method get_oid: int
+ method as_source_languages_manager:
+ Gtk_sourceview.source_languages_manager obj
+ method get_language_from_mime_type: string -> source_language option
+ method lang_files_dirs: string list
+ end
+
+val source_languages_manager:
+(* ?lang_files_dirs:string list -> *)
+ unit ->
+ source_languages_manager
+
+val source_language_from_file:
+ ?languages_manager:source_languages_manager -> string ->
+ source_language option
+
+(** {2 GtkSourceBuffer} *)
+
+class source_buffer_signals:
+ ([> Gtk_sourceview.source_buffer ] as 'b) obj ->
+ object ('a)
+ inherit GText.buffer_signals
+ method can_redo: callback:(bool -> unit) -> GtkSignal.id
+ method can_undo: callback:(bool -> unit) -> GtkSignal.id
+ method highlight_updated:
+ callback:(Gtk.text_iter -> Gtk.text_iter -> unit) -> GtkSignal.id
+ method marker_updated: callback:(Gtk.text_iter -> unit) -> GtkSignal.id
+ end
+
+class source_buffer:
+ Gtk_sourceview.source_buffer obj ->
+ object
+ inherit GText.buffer_skel
+ method connect: source_buffer_signals
+ method misc: GObj.gobject_ops
+ method check_brackets: bool
+ method set_check_brackets: bool -> unit
+(* method set_bracket_match_style: tag_style -> unit *)
+ method highlight: bool
+ method set_highlight: bool -> unit
+ method max_undo_levels: int
+ method set_max_undo_levels: int -> unit
+ method language: source_language option
+ method set_language: source_language -> unit
+ method escape_char: Glib.unichar
+ method set_escape_char: Glib.unichar -> unit
+ method can_undo: bool
+ method can_redo: bool
+ method undo: unit -> unit
+ method redo: unit -> unit
+ method begin_not_undoable_action: unit -> unit
+ method end_not_undoable_action: unit -> unit
+(* method create_marker: name:char -> typ:char -> source_marker *)
+(* method move_marker: source_marker -> Gtext.text_iter -> unit *)
+(* method delete_marker: source_marker -> unit *)
+(* method get_marker: name:char -> source_marker *)
+(* method get_markers_in_region:
+ start:text_iter -> stop:text_iter -> source_marker list *)
+(* method get_first_marker: unit -> source_marker *)
+(* method get_last_marker: unit -> source_marker *)
+(* method get_iter_at_marker: ... *)
+(* method get_next_marker: unit -> source_marker *)
+(* method get_prev_marker: unit -> source_marker *)
+ end
+
+val source_buffer:
+ ?language:source_language ->
+(* ?tag_table:source_tag_table -> *)
+ ?text:string ->
+ ?check_brackets:bool ->
+ ?escape_char:int ->
+ ?highlight:bool ->
+ ?max_undo_levels:int ->
+ unit ->
+ source_buffer
+
+(** {2 GtkSourceView} *)
+
+class source_view_signals:
+ ([> Gtk_sourceview.source_view ] as 'b) obj ->
+ object ('a)
+ inherit GText.view_signals
+ method redo: callback:(unit -> unit) -> GtkSignal.id
+ method undo: callback:(unit -> unit) -> GtkSignal.id
+ end
+
+class source_view:
+ Gtk_sourceview.source_view obj ->
+ object
+ inherit GText.view_skel
+ val obj: Gtk_sourceview.source_view obj
+ method connect: source_view_signals
+ method source_buffer: source_buffer
+ method set_show_line_numbers: bool -> unit
+ method show_line_numbers: bool
+ method set_show_line_markers: bool -> unit
+ method show_line_markers: bool
+ method set_tabs_width: int -> unit
+ method tabs_width: int
+ method set_auto_indent: bool -> unit
+ method auto_indent: bool
+ method set_insert_spaces_instead_of_tabs: bool -> unit
+ method insert_spaces_instead_of_tabs: bool
+ method set_show_margin: bool -> unit
+ method show_margin: bool
+ method set_margin: int -> unit
+ method margin: int
+(* method set_marker_pixbuf: GdkPixbuf.pixbuf -> unit *)
+(* method marker_pixbuf: GdkPixbuf.pixbuf *)
+ method set_smart_home_end: bool -> unit
+ method smart_home_end: bool
+ end
+
+val source_view:
+ ?source_buffer:source_buffer ->
+ ?auto_indent:bool ->
+ ?insert_spaces_instead_of_tabs:bool ->
+ ?margin:int ->
+ ?show_line_markers:bool ->
+ ?show_line_numbers:bool ->
+ ?show_margin:bool ->
+ ?smart_home_end:bool ->
+ ?tabs_width:int ->
+ ?editable:bool ->
+ ?cursor_visible:bool ->
+ ?justification:GtkEnums.justification ->
+ ?wrap_mode:GtkEnums.wrap_mode ->
+ ?border_width:int ->
+ ?width:int ->
+ ?height:int ->
+ ?packing:(GObj.widget -> unit) ->
+ ?show:bool ->
+ unit ->
+ source_view
+
+(** {2 Misc} *)
+
+val find_matching_bracket: GText.iter -> GText.iter option
+
--- /dev/null
+(*
+ * lablgtksourceview, OCaml binding for the GtkSourceView text widget
+ *
+ * Copyright (C) 2005 Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *)
+
+open Gtk_sourceview
+open Gaux
+open Gobject
+open Gtk
+open Tags
+open GtkSourceViewProps
+open GtkBase
+
+(* external gslist_of_string_list: string list -> 'a obj =
+ "ml_gslist_of_string_list" *)
+
+external _gtk_source_language_init: unit -> unit = "ml_gtk_source_language_init"
+external _gtk_source_languages_manager_init: unit -> unit =
+ "ml_gtk_source_languages_manager_init"
+external _gtk_source_buffer_init: unit -> unit = "ml_gtk_source_buffer_init"
+external _gtk_source_view_init: unit -> unit = "ml_gtk_source_view_init"
+
+let () =
+ _gtk_source_language_init ();
+ _gtk_source_languages_manager_init ();
+ _gtk_source_buffer_init ();
+ _gtk_source_view_init ()
+
+module SourceLanguage =
+struct
+ include SourceLanguage
+ external new_from_file:
+ string -> [>`sourcelanguagesmanager] obj -> source_language obj option
+ =
+ "ml__gtk_source_language_new_from_file"
+ external get_name: [>`sourcelanguage] obj -> string =
+ "ml_gtk_source_language_get_name"
+ external get_section: [>`sourcelanguage] obj -> string =
+ "ml_gtk_source_language_get_section"
+(* external get_tags: [>`sourcelanguage] obj -> source_tag list *)
+ external get_escape_char: [>`sourcelanguage] obj -> Glib.unichar =
+ "ml_gtk_source_language_get_escape_char"
+(* external get_mime_types: [>`sourcelanguage] obj -> string list *)
+(* external set_mime_types: [>`sourcelanguage] obj -> string list -> unit *)
+(* external get_style_scheme: [>`sourcelanguage] obj -> style_scheme *)
+(* external set_style_char: [>`sourcelanguage] obj -> style_scheme -> unit *)
+(* external get_tag_style: [>`sourcelanguage] obj -> tag_style *)
+(* external set_tag_style: [>`sourcelanguage] obj -> string -> tag_style -> unit *)
+(* external get_tag_default_style: [>`sourcelanguage] obj -> string -> tag_style *)
+end
+
+module SourceLanguagesManager =
+struct
+ include SourceLanguagesManager
+ external new_: unit -> source_languages_manager obj =
+ "ml_gtk_source_languages_manager_new"
+(* external get_available_languages:
+ [>`sourcelanguagesmanager] obj -> source_language obj list
+ = "ml_gtk_source_languages_manager_get_available_languages" *)
+ external get_language_from_mime_type:
+ [>`sourcelanguagesmanager] obj -> string -> source_language obj option
+ = "ml_gtk_source_languages_manager_get_language_from_mime_type"
+ external get_lang_files_dirs:
+ [>`sourcelanguagesmanager] obj -> string list
+ = "ml_gtk_source_languages_manager_get_lang_files_dirs"
+(* external set_lang_files_dirs:
+ [>`sourcelanguagesmanager] obj -> string list -> unit
+ = "ml_gtk_source_languages_manager_set_lang_files_dirs" *)
+end
+
+module SourceBuffer =
+struct
+ include SourceBuffer
+(* external new_: unit -> source_buffer obj = "ml_gtk_source_buffer_new" *)
+(* external new_with_buffer: [>`sourcelanguage] obj -> source_buffer obj =
+ "ml_gtk_source_buffer_new_with_language" *)
+ external can_undo: [>`sourcebuffer] obj -> bool =
+ "ml_gtk_source_buffer_can_undo"
+ external can_redo: [>`sourcebuffer] obj -> bool =
+ "ml_gtk_source_buffer_can_redo"
+ external undo: [>`sourcebuffer] obj -> unit = "ml_gtk_source_buffer_undo"
+ external redo: [>`sourcebuffer] obj -> unit = "ml_gtk_source_buffer_redo"
+ external begin_not_undoable_action: [>`sourcebuffer] obj -> unit =
+ "ml_gtk_source_buffer_begin_not_undoable_action"
+ external end_not_undoable_action: [>`sourcebuffer] obj -> unit =
+ "ml_gtk_source_buffer_end_not_undoable_action"
+end
+
+module SourceView =
+struct
+ include SourceView
+ external new_: unit -> source_view obj = "ml_gtk_source_view_new"
+ external new_with_buffer: [>`sourcebuffer] obj -> source_view obj =
+ "ml_gtk_source_view_new_with_buffer"
+end
+
+module SourceViewMisc =
+struct
+ external find_matching_bracket: text_iter -> bool =
+ "ml_gtk_source_iter_find_matching_bracket"
+end
+
--- /dev/null
+
+prefix "Gtk"
+
+header {
+ open Gtk_sourceview
+}
+
+class SourceLanguage type "source_language obj" set wrapsig : GObject {
+ signal tag_style_changed: string
+}
+
+class SourceLanguagesManager type "source_languages_manager obj" set wrapsig : GObject {
+(* "lang-files-dirs" gpointer : Read / Write / Construct Only *)
+}
+
+class SourceBuffer type "source_buffer obj" set wrapsig : GObject {
+ "check-brackets" gboolean : Read / Write
+ "escape-char" guint : Read / Write
+ "highlight" gboolean : Read / Write
+ "language" GtkSourceLanguage : Read / Write
+ "max-undo-levels" gint : Read / Write
+ signal can_redo: gboolean
+ signal can_undo: gboolean
+ signal highlight_updated: GtkTextIter GtkTextIter
+ signal marker_updated: GtkTextIter
+}
+
+class SourceView type "source_view obj" set wrapsig : Widget {
+ "auto-indent" gboolean : Read / Write
+ "insert-spaces-instead-of-tabs" gboolean : Read / Write
+ "margin" guint : Read / Write
+ "show-line-markers" gboolean : Read / Write
+ "show-line-numbers" gboolean : Read / Write
+ "show-margin" gboolean : Read / Write
+ "smart-home-end" gboolean : Read / Write
+ "tabs-width" guint : Read / Write
+ signal redo
+ signal undo
+}
+
--- /dev/null
+(*
+ * lablgtksourceview, OCaml binding for the GtkSourceView text widget
+ *
+ * Copyright (C) 2005 Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *)
+
+type source_view = [Gtk.text_view|`sourceview]
+type source_buffer = [`textbuffer|`sourcebuffer]
+type source_language = [`sourcelanguage]
+type source_languages_manager = [`sourcelanguagesmanager]
+
--- /dev/null
+/*
+ * lablgtksourceview, OCaml binding for the GtkSourceView text widget
+ *
+ * Copyright (C) 2005 Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include <assert.h>
+
+#include <gtksourceview/gtksourceview.h>
+#include <gtksourceview/gtksourcelanguagesmanager.h>
+
+#include <caml/mlvalues.h>
+#include <caml/alloc.h>
+#include <caml/memory.h>
+#include <caml/callback.h>
+#include <caml/fail.h>
+#include <caml/custom.h>
+#include <caml/callback.h>
+
+#include <wrappers.h>
+#include <ml_glib.h>
+#include <ml_gdk.h>
+#include <ml_gtk.h>
+#include <ml_gobject.h>
+#include <ml_gdkpixbuf.h>
+#include <ml_pango.h>
+#include <gtk_tags.h>
+#include <gdk_tags.h>
+
+CAMLprim value ml_gtk_source_language_init(value unit)
+{ /* Since these are declared const, must force gcc to call them! */
+ GType t = gtk_source_language_get_type();
+ return Val_GType(t);
+}
+
+CAMLprim value ml_gtk_source_languages_manager_init(value unit)
+{ /* Since these are declared const, must force gcc to call them! */
+ GType t = gtk_source_languages_manager_get_type();
+ return Val_GType(t);
+}
+
+CAMLprim value ml_gtk_source_buffer_init(value unit)
+{ /* Since these are declared const, must force gcc to call them! */
+ GType t = gtk_source_buffer_get_type();
+ return Val_GType(t);
+}
+
+CAMLprim value ml_gtk_source_view_init(value unit)
+{ /* Since these are declared const, must force gcc to call them! */
+ GType t = gtk_source_view_get_type();
+ return Val_GType(t);
+}
+
+static gpointer string_val(value v)
+{
+ return String_val(v);
+}
+
+GSList *ml_gslist_of_string_list(value list)
+{
+ GSList_val(list, string_val);
+}
+
+/* CAMLprim value
+ml_gtk_source_languages_manager_set_lang_files_dirs(GObject *obj, value list)
+{
+ GSList *gslist = ml_gslist_of_string_list(list);
+ g_object_set_property(obj, "lang-files-dirs", gslist);
+ return Val_unit;
+} */
+
+#define GtkSourceLanguage_val(val) check_cast(GTK_SOURCE_LANGUAGE,val)
+#define GtkSourceLanguagesManager_val(val)\
+ check_cast(GTK_SOURCE_LANGUAGES_MANAGER,val)
+#define GtkSourceTagTable_val(val) check_cast(GTK_SOURCE_TAG_TABLE,val)
+#define GtkSourceBuffer_val(val) check_cast(GTK_SOURCE_BUFFER,val)
+#define GtkSourceView_val(val) check_cast(GTK_SOURCE_VIEW,val)
+#define GtkTextIter_val(val) ((GtkTextIter*)MLPointer_val(val))
+#define Val_option_GtkAny(v) Val_option(v,Val_GtkAny)
+#define string_list_of_GSList(l) Val_GSList(l, (value_in) Val_string)
+/* #define GSList_of_string_list(l) GSList_val(l, String_val) */
+/* #define GSList_of_string_list(l) GSList_val(l, ml_string_val) */
+
+ML_2 (_gtk_source_language_new_from_file, String_val,
+ GtkSourceLanguagesManager_val, Val_option_GtkAny)
+ML_1 (gtk_source_language_get_name, GtkSourceLanguage_val, Val_string)
+ML_1 (gtk_source_language_get_section, GtkSourceLanguage_val, Val_string)
+ML_1 (gtk_source_language_get_escape_char, GtkSourceLanguage_val, Val_int)
+
+ML_0 (gtk_source_languages_manager_new, Val_GtkAny_sink)
+ML_2 (gtk_source_languages_manager_get_language_from_mime_type,
+ GtkSourceLanguagesManager_val, String_val,
+ Val_option_GtkAny)
+ML_1 (gtk_source_languages_manager_get_lang_files_dirs,
+ GtkSourceLanguagesManager_val, string_list_of_GSList)
+
+/* ML_0 (gtk_source_buffer_new, GtkSourceTagTable_val, Val_GtkAny_sink) */
+/* ML_1 (gtk_source_buffer_new_with_language, GtkSourceLanguage_val,
+ Val_GtkAny_sink) */
+ML_1 (gtk_source_buffer_can_undo, GtkSourceBuffer_val, Val_bool)
+ML_1 (gtk_source_buffer_can_redo, GtkSourceBuffer_val, Val_bool)
+ML_1 (gtk_source_buffer_undo, GtkSourceBuffer_val, Unit)
+ML_1 (gtk_source_buffer_redo, GtkSourceBuffer_val, Unit)
+ML_1 (gtk_source_buffer_begin_not_undoable_action, GtkSourceBuffer_val, Unit)
+ML_1 (gtk_source_buffer_end_not_undoable_action, GtkSourceBuffer_val, Unit)
+
+ML_0 (gtk_source_view_new, Val_GtkWidget_sink)
+ML_1 (gtk_source_view_new_with_buffer, GtkSourceBuffer_val, Val_GtkWidget_sink)
+
+ML_1 (gtk_source_iter_find_matching_bracket, GtkTextIter_val, Val_bool)
+
--- /dev/null
+*.cmo *.cmi *.cmx *.o *.a *.cmxa *.cma
+test test.opt
+Makefile
--- /dev/null
+PACKAGES = lablgtk2.init
+PACKAGE = @PACKAGE@
+BUILDFLAGS = -package "$(PACKAGES)" -I ../
+LINKFLAGS = $(BUILDFLAGS) -linkpkg
+OCAMLC = ocamlfind ocamlc
+OCAMLOPT = ocamlfind ocamlopt
+TMPDIR = .test
+
+all: test
+opt: test.opt
+
+test: test.ml ../$(PACKAGE).cma
+ $(OCAMLC) $(LINKFLAGS) $(PACKAGE).cma -o $@ $<
+
+test.opt: test.ml ../$(PACKAGE).cmxa
+ $(OCAMLOPT) $(LINKFLAGS) $(PACKAGE).cmxa -o $@ $<
+
+clean:
+ rm -f *.cm[iox] *.[ao] *.cmxa test test.opt
+
+distclean:
+ rm Makefile
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE language SYSTEM "language.dtd">
+<language _name="C" version="1.0" _section="Sources" mimetypes="text/x-c;text/x-chdr;text/x-csrc">
+
+ <escape-char>\</escape-char>
+
+ <line-comment _name = "Line Comment" style= "Comment">
+ <start-regex>//</start-regex>
+ </line-comment>
+
+ <block-comment _name = "Block Comment" style = "Comment">
+ <start-regex>/\*</start-regex>
+ <end-regex>\*/</end-regex>
+ </block-comment>
+
+ <block-comment _name = "'#if 0' Comment" style = "Comment">
+ <start-regex>^[ \t]*#[ \t]*if[ \t]*0</start-regex>
+ <end-regex>[ \t]*#[ \t]*(endif|else)</end-regex>
+ </block-comment>
+
+ <string _name = "String" style = "String" end-at-line-end = "TRUE">
+ <start-regex>"</start-regex>
+ <end-regex>"</end-regex>
+ </string>
+
+ <syntax-item _name = "Include/Pragma" style = "Preprocessor">
+ <start-regex>^#[ \t]*(include|pragma)</start-regex>
+ <end-regex>\n</end-regex>
+ </syntax-item>
+
+ <keyword-list _name = "Keywords" style = "Keyword" case-sensitive="TRUE">
+ <keyword>asm</keyword>
+ <keyword>break</keyword>
+ <keyword>case</keyword>
+ <keyword>continue</keyword>
+ <keyword>default</keyword>
+ <keyword>do</keyword>
+ <keyword>else</keyword>
+ <keyword>for</keyword>
+ <keyword>fortran</keyword>
+ <keyword>goto</keyword>
+ <keyword>if</keyword>
+ <keyword>return</keyword>
+ <keyword>sizeof</keyword>
+ <keyword>switch</keyword>
+ <keyword>while</keyword>
+ </keyword-list>
+
+ <keyword-list _name = "Types" style = "Data Type" case-sensitive="TRUE">
+ <keyword>_Bool</keyword>
+ <keyword>_Complex</keyword>
+ <keyword>_Imaginary</keyword>
+ <keyword>auto</keyword>
+ <keyword>char</keyword>
+ <keyword>const</keyword>
+ <keyword>double</keyword>
+ <keyword>enum</keyword>
+ <keyword>extern</keyword>
+ <keyword>float</keyword>
+ <keyword>int</keyword>
+ <keyword>inline</keyword>
+ <keyword>long</keyword>
+ <keyword>register</keyword>
+ <keyword>restrict</keyword>
+ <keyword>short</keyword>
+ <keyword>signed</keyword>
+ <keyword>static</keyword>
+ <keyword>struct</keyword>
+ <keyword>typedef</keyword>
+ <keyword>union</keyword>
+ <keyword>unsigned</keyword>
+ <keyword>void</keyword>
+ <keyword>volatile</keyword>
+ </keyword-list>
+
+ <string _name = "Character Constant" style = "String" end-at-line-end = "TRUE">
+ <start-regex>'</start-regex>
+ <end-regex>'</end-regex>
+ </string>
+
+ <pattern-item _name = "Decimal" style = "Decimal">
+ <regex>\b([1-9][0-9]*|0)([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</regex>
+ </pattern-item>
+
+ <pattern-item _name = "Floating Point Number" style = "Floating Point">
+ <regex>\b([0-9]+[Ee][-]?[0-9]+|([0-9]*\.[0-9]+|[0-9]+\.)([Ee][-]?[0-9]+)?)[fFlL]?</regex>
+ </pattern-item>
+
+ <pattern-item _name = "Octal Number" style = "Base-N Integer">
+ <regex>\b0[0-7]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</regex>
+ </pattern-item>
+
+ <pattern-item _name = "Hex Number" style = "Base-N Integer">
+ <regex>\b0[xX][0-9a-fA-F]+([Uu]([Ll]|LL|ll)?|([Ll]|LL|ll)[Uu]?)?\b</regex>
+ </pattern-item>
+
+ <keyword-list _name = "Common Macro" style = "Preprocessor" case-sensitive="TRUE">
+ <keyword>NULL</keyword>
+ <keyword>TRUE</keyword>
+ <keyword>FALSE</keyword>
+ <keyword>MAX</keyword>
+ <keyword>MIN</keyword>
+ <keyword>__LINE__</keyword>
+ <keyword>__DATA__</keyword>
+ <keyword>__FILE__</keyword>
+ <keyword>__func__</keyword>
+ <keyword>__TIME__</keyword>
+ <keyword>__STDC__</keyword>
+ </keyword-list>
+
+ <keyword-list _name = "Preprocessor Definitions" style = "Preprocessor" case-sensitive="TRUE"
+ match-empty-string-at-beginning = "FALSE"
+ match-empty-string-at-end = "TRUE"
+ beginning-regex = "^[ \t]*#[ \t]*">
+ <keyword>if</keyword>
+ <keyword>ifdef</keyword>
+ <keyword>ifndef</keyword>
+ <keyword>else</keyword>
+ <keyword>elif</keyword>
+ <keyword>define</keyword>
+ <keyword>endif</keyword>
+ <keyword>undef</keyword>
+ <keyword>error</keyword>
+ <keyword>pragma</keyword>
+ <keyword>line</keyword>
+ </keyword-list>
+
+</language>
--- /dev/null
+(*
+ * lablgtksourceview, OCaml binding for the GtkSourceView text widget
+ *
+ * Copyright (C) 2005 Stefano Zacchiroli <zack@cs.unibo.it>
+ *
+ * This library is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *)
+
+open Printf
+
+let lang_mime_type = "text/x-c"
+let lang_file = "test.lang"
+let use_mime_type = false
+let font_name = "Monospace 10"
+
+let print_lang lang = prerr_endline (sprintf "language: %s" lang#get_name)
+
+let print_lang_dirs languages_manager =
+ let i = ref 0 in
+ prerr_endline "lang_dirs:";
+ List.iter
+ (fun dir -> incr i; prerr_endline (sprintf "%d: %s" !i dir))
+ languages_manager#lang_files_dirs
+
+let win = GWindow.window ~title:"LablGtkSourceView test" ()
+let vbox = GPack.vbox ~packing:win#add ()
+let hbox = GPack.hbox ~packing:vbox#add ()
+let bracket_button = GButton.button ~label:"( ... )" ~packing:hbox#add ()
+let scrolled_win = GBin.scrolled_window ~packing:vbox#add ()
+let source_view =
+ GSourceView.source_view
+ ~auto_indent:true
+(* ~insert_spaces_instead_of_tabs:true ~tabs_width:2 *)
+ ~show_line_numbers:true
+ ~margin:80 ~show_margin:true
+ ~smart_home_end:true
+ ~packing:scrolled_win#add ~height:500 ~width:650
+ ()
+(* let languages_manager =
+ GSourceView.source_languages_manager ~lang_files_dirs:["/etc"] () *)
+let languages_manager = GSourceView.source_languages_manager ()
+
+let lang =
+ if use_mime_type then
+ match languages_manager#get_language_from_mime_type lang_mime_type with
+ | None -> failwith (sprintf "no language for %s" lang_mime_type)
+ | Some lang -> lang
+ else
+ match
+ GSourceView.source_language_from_file ~languages_manager lang_file
+ with
+ | None -> failwith (sprintf "can't load %s" lang_file)
+ | Some lang -> lang
+
+let matching_bracket () =
+ let iter = source_view#source_buffer#get_iter_at_mark `INSERT in
+ match GSourceView.find_matching_bracket iter with
+ | None -> prerr_endline "no matching bracket"
+ | Some iter ->
+ source_view#source_buffer#place_cursor iter;
+ source_view#misc#grab_focus ()
+
+let _ =
+ let text =
+ let ic = open_in "test.txt" in
+ let size = in_channel_length ic in
+ let buf = String.create size in
+ really_input ic buf 0 size;
+ close_in ic;
+ buf
+ in
+ win#set_allow_shrink true;
+ source_view#misc#modify_font_by_name font_name;
+ print_lang_dirs languages_manager;
+ print_lang lang;
+ source_view#source_buffer#set_language lang;
+ source_view#source_buffer#set_highlight true;
+ source_view#source_buffer#set_text text;
+ ignore (win#connect#destroy (fun _ -> GMain.quit ()));
+ ignore (bracket_button#connect#clicked matching_bracket);
+(* ignore (source_view#connect#move_cursor (fun _ _ ~extend ->
+ prerr_endline "move_cursor"));
+ ignore (source_view#connect#undo (fun _ -> prerr_endline "undo")); *)
+ win#show ();
+ GMain.Main.main ()
+
--- /dev/null
+/* CPU control.
+ * (C) 2001, 2002, 2003, 2004 Rusty Russell
+ *
+ * This code is licenced under the GPL.
+ */
+#include <linux/proc_fs.h>
+#include <linux/smp.h>
+#include <linux/init.h>
+#include <linux/notifier.h>
+#include <linux/sched.h>
+#include <linux/unistd.h>
+#include <linux/cpu.h>
+#include <linux/module.h>
+#include <linux/kmod.h> /* for hotplug_path */
+#include <linux/kthread.h>
+#include <linux/stop_machine.h>
+#include <asm/semaphore.h>
+
+/* This protects CPUs going up and down... */
+DECLARE_MUTEX(cpucontrol);
+
+static struct notifier_block *cpu_chain;
+
+/* Need to know about CPUs going up/down? */
+int register_cpu_notifier(struct notifier_block *nb)
+{
+ int ret;
+
+ if ((ret = down_interruptible(&cpucontrol)) != 0)
+ return ret;
+ ret = notifier_chain_register(&cpu_chain, nb);
+ up(&cpucontrol);
+ return ret;
+}
+EXPORT_SYMBOL(register_cpu_notifier);
+
+void unregister_cpu_notifier(struct notifier_block *nb)
+{
+ down(&cpucontrol);
+ notifier_chain_unregister(&cpu_chain, nb);
+ up(&cpucontrol);
+}
+EXPORT_SYMBOL(unregister_cpu_notifier);
+
+#ifdef CONFIG_HOTPLUG_CPU
+static inline void check_for_tasks(int cpu)
+{
+ struct task_struct *p;
+
+ write_lock_irq(&tasklist_lock);
+ for_each_process(p) {
+ if (task_cpu(p) == cpu && (p->utime != 0 || p->stime != 0))
+ printk(KERN_WARNING "Task %s (pid = %d) is on cpu %d\
+ (state = %ld, flags = %lx) \n",
+ p->comm, p->pid, cpu, p->state, p->flags);
+ }
+ write_unlock_irq(&tasklist_lock);
+}
+
+/* Notify userspace when a cpu event occurs, by running '/sbin/hotplug
+ * cpu' with certain environment variables set. */
+static int cpu_run_sbin_hotplug(unsigned int cpu, const char *action)
+{
+ char *argv[3], *envp[5], cpu_str[12], action_str[32];
+ int i;
+
+ sprintf(cpu_str, "CPU=%d", cpu);
+ sprintf(action_str, "ACTION=%s", action);
+ /* FIXME: Add DEVPATH. --RR */
+
+ i = 0;
+ argv[i++] = hotplug_path;
+ argv[i++] = "cpu";
+ argv[i] = NULL;
+
+ i = 0;
+ /* minimal command environment */
+ envp[i++] = "HOME=/";
+ envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+ envp[i++] = cpu_str;
+ envp[i++] = action_str;
+ envp[i] = NULL;
+
+ return call_usermodehelper(argv[0], argv, envp, 0);
+}
+
+/* Take this CPU down. */
+static int take_cpu_down(void *unused)
+{
+ int err;
+
+ /* Take offline: makes arch_cpu_down somewhat easier. */
+ cpu_clear(smp_processor_id(), cpu_online_map);
+
+ /* Ensure this CPU doesn't handle any more interrupts. */
+ err = __cpu_disable();
+ if (err < 0)
+ cpu_set(smp_processor_id(), cpu_online_map);
+ else
+ /* Force idle task to run as soon as we yield: it should
+ immediately notice cpu is offline and die quickly. */
+ sched_idle_next();
+
+ return err;
+}
+
+int cpu_down(unsigned int cpu)
+{
+ int err;
+ struct task_struct *p;
+ cpumask_t old_allowed, tmp;
+
+ if ((err = lock_cpu_hotplug_interruptible()) != 0)
+ return err;
+
+ if (num_online_cpus() == 1) {
+ err = -EBUSY;
+ goto out;
+ }
+
+ if (!cpu_online(cpu)) {
+ err = -EINVAL;
+ goto out;
+ }
+
+ /* Ensure that we are not runnable on dying cpu */
+ old_allowed = current->cpus_allowed;
+ tmp = CPU_MASK_ALL;
+ cpu_clear(cpu, tmp);
+ set_cpus_allowed(current, tmp);
+
+ p = __stop_machine_run(take_cpu_down, NULL, cpu);
+ if (IS_ERR(p)) {
+ err = PTR_ERR(p);
+ goto out_allowed;
+ }
+
+ if (cpu_online(cpu))
+ goto out_thread;
+
+ /* Wait for it to sleep (leaving idle task). */
+ while (!idle_cpu(cpu))
+ yield();
+
+ /* This actually kills the CPU. */
+ __cpu_die(cpu);
+
+ /* Move it here so it can run. */
+ kthread_bind(p, smp_processor_id());
+
+ /* CPU is completely dead: tell everyone. Too late to complain. */
+ if (notifier_call_chain(&cpu_chain, CPU_DEAD, (void *)(long)cpu)
+ == NOTIFY_BAD)
+ BUG();
+
+ check_for_tasks(cpu);
+
+ cpu_run_sbin_hotplug(cpu, "offline");
+
+out_thread:
+ err = kthread_stop(p);
+out_allowed:
+ set_cpus_allowed(current, old_allowed);
+out:
+ unlock_cpu_hotplug();
+ return err;
+}
+#else
+static inline int cpu_run_sbin_hotplug(unsigned int cpu, const char *action)
+{
+ return 0;
+}
+#endif /*CONFIG_HOTPLUG_CPU*/
+
+int __devinit cpu_up(unsigned int cpu)
+{
+ int ret;
+ void *hcpu = (void *)(long)cpu;
+
+ if ((ret = down_interruptible(&cpucontrol)) != 0)
+ return ret;
+
+ if (cpu_online(cpu) || !cpu_present(cpu)) {
+ ret = -EINVAL;
+ goto out;
+ }
+ ret = notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
+ if (ret == NOTIFY_BAD) {
+ printk("%s: attempt to bring up CPU %u failed\n",
+ __FUNCTION__, cpu);
+ ret = -EINVAL;
+ goto out_notify;
+ }
+
+ /* Arch-specific enabling code. */
+ ret = __cpu_up(cpu);
+ if (ret != 0)
+ goto out_notify;
+ if (!cpu_online(cpu))
+ BUG();
+
+ /* Now call notifier in preparation. */
+ notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu);
+
+out_notify:
+ if (ret != 0)
+ notifier_call_chain(&cpu_chain, CPU_UP_CANCELED, hcpu);
+out:
+ up(&cpucontrol);
+ return ret;
+}