Fix building.

git-svn-id: svn://localhost/ardour2/trunk@2791 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2007-12-18 07:20:02 +00:00
parent 35fc31a1de
commit 47a41c0d4d
107 changed files with 30979 additions and 11 deletions

View file

@ -0,0 +1,11 @@
include $(top_srcdir)/tools/Makefile_list_of_sources.am_fragment
SUBDIRS = m4 pm extra_defs_gen
EXTRA_DIST = Makefile_list_of_sources.am_fragment $(files_tools_perl) README TODO enum.pl
gmmproc_bin_SCRIPTS = gmmproc $(files_tools_genwrap)
gmmproc_bindir = $(libdir)/glibmm-2.4/proc

View file

@ -0,0 +1,557 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/generate_wrap_init.pl.in $(srcdir)/gmmproc.in \
$(top_srcdir)/tools/Makefile_list_of_sources.am_fragment \
$(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment \
$(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment \
TODO
subdir = tools
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/scripts/c_std.m4 \
$(top_srcdir)/scripts/cxx.m4 $(top_srcdir)/scripts/cxx_std.m4 \
$(top_srcdir)/scripts/docgen.m4 \
$(top_srcdir)/scripts/glibmm_check_perl.m4 \
$(top_srcdir)/scripts/macros.m4 \
$(top_srcdir)/scripts/reduced.m4 $(top_srcdir)/scripts/sun.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/glib/glibmmconfig.h
CONFIG_CLEAN_FILES = gmmproc generate_wrap_init.pl
am__installdirs = "$(DESTDIR)$(gmmproc_bindir)"
gmmproc_binSCRIPT_INSTALL = $(INSTALL_SCRIPT)
SCRIPTS = $(gmmproc_bin_SCRIPTS)
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISABLE_DEPRECATED_API_CFLAGS = @DISABLE_DEPRECATED_API_CFLAGS@
DISABLE_DEPRECATED_CFLAGS = @DISABLE_DEPRECATED_CFLAGS@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GLIBMM_CFLAGS = @GLIBMM_CFLAGS@
GLIBMM_LIBS = @GLIBMM_LIBS@
GLIBMM_MAJOR_VERSION = @GLIBMM_MAJOR_VERSION@
GLIBMM_MICRO_VERSION = @GLIBMM_MICRO_VERSION@
GLIBMM_MINOR_VERSION = @GLIBMM_MINOR_VERSION@
GLIBMM_RELEASE = @GLIBMM_RELEASE@
GLIBMM_VERSION = @GLIBMM_VERSION@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTKMMPROC_MERGECDOCS = @GTKMMPROC_MERGECDOCS@
GTKMM_DOXYGEN_INPUT = @GTKMM_DOXYGEN_INPUT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBGLIBMM_SO_VERSION = @LIBGLIBMM_SO_VERSION@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL_PATH = @PERL_PATH@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
files_tools_m4 = base.m4 class_shared.m4 class_boxedtype.m4 class_boxedtype_static.m4 \
class_generic.m4 class_gobject.m4 class_gtkobject.m4 \
class_interface.m4 class_opaque_refcounted.m4 class_opaque_copyable.m4 \
gerror.m4 \
compare.m4 convert.m4 convert_base.m4 convert_gtkmm.m4 convert_atk.m4 convert_gdk.m4 \
convert_glib.m4 convert_gtk.m4 convert_pango.m4 ctor.m4 doc.m4 enum.m4 list.m4 member.m4 \
method.m4 property.m4 signal.m4 vfunc.m4
files_tools_pm = DocsParser.pm GtkDefs.pm Enum.pm Function.pm FunctionBase.pm Object.pm Output.pm Property.pm Util.pm WrapParser.pm
files_tools_genwrap = generate_wrap_init.pl
files_tools_perl = $(files_tools_genwrap) gmmproc.in
SUBDIRS = m4 pm extra_defs_gen
EXTRA_DIST = Makefile_list_of_sources.am_fragment $(files_tools_perl) README TODO enum.pl
gmmproc_bin_SCRIPTS = gmmproc $(files_tools_genwrap)
gmmproc_bindir = $(libdir)/glibmm-2.4/proc
all: all-recursive
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/tools/Makefile_list_of_sources.am_fragment $(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment $(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tools/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
gmmproc: $(top_builddir)/config.status $(srcdir)/gmmproc.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
generate_wrap_init.pl: $(top_builddir)/config.status $(srcdir)/generate_wrap_init.pl.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
install-gmmproc_binSCRIPTS: $(gmmproc_bin_SCRIPTS)
@$(NORMAL_INSTALL)
test -z "$(gmmproc_bindir)" || $(MKDIR_P) "$(DESTDIR)$(gmmproc_bindir)"
@list='$(gmmproc_bin_SCRIPTS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
if test -f $$d$$p; then \
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
echo " $(gmmproc_binSCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(gmmproc_bindir)/$$f'"; \
$(gmmproc_binSCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(gmmproc_bindir)/$$f"; \
else :; fi; \
done
uninstall-gmmproc_binSCRIPTS:
@$(NORMAL_UNINSTALL)
@list='$(gmmproc_bin_SCRIPTS)'; for p in $$list; do \
f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
echo " rm -f '$(DESTDIR)$(gmmproc_bindir)/$$f'"; \
rm -f "$(DESTDIR)$(gmmproc_bindir)/$$f"; \
done
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-recursive
all-am: Makefile $(SCRIPTS)
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(gmmproc_bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-gmmproc_binSCRIPTS
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-recursive
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-gmmproc_binSCRIPTS
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
ctags ctags-recursive distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-gmmproc_binSCRIPTS install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-gmmproc_binSCRIPTS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,5 @@
include $(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment
include $(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment
files_tools_genwrap = generate_wrap_init.pl
files_tools_perl = $(files_tools_genwrap) gmmproc.in

View file

@ -0,0 +1,4 @@
This directory contains the gtkmm preprocessor used for wrapping
gtk+ objects.
See docs/internal/ for some gtkmmproc documentation.

12
libs/glibmm2/tools/TODO Normal file
View file

@ -0,0 +1,12 @@
* streams
- Please give more information. murrayc
* Incorporate new GtkDefs parser.
What does this mean? murrayc.
* Get gtkmmproc to run outside install directory.
What does this mean? It runs for gtkmm and it runs installed for libgnome*mm.

233
libs/glibmm2/tools/enum.pl Normal file
View file

@ -0,0 +1,233 @@
#! /usr/bin/perl
# The lisp definitions for flags does not include order.
# thus we must extract it ourselves.
# Usage: ./enum.pl /gnome/head/cvs/gconf/gconf/*.h > gconf_enums.defs
use warnings;
my %token;
$module="none";
while ($ARGV[0] =~ /^--(\S+)/)
{
shift @ARGV;
$module=shift @ARGV if ($1 eq "module");
if ($1 eq "help")
{
print "enum.pl [--module modname] header_files ....\n";
exit 0;
}
}
foreach $file (@ARGV)
{
&parse($file);
}
exit;
# parse enums from C
sub parse
{
my ($file)=@_;
$from=0;
open(FILE,$file);
$enum=0;
$deprecated=0;
$comment=0;
while(<FILE>)
{
if($comment)
{
# end of multiline comment
$comment = 0 if(/\*\//);
next;
}
$deprecated = 1 if(s/^#ifndef [A-Z_]+_DISABLE_DEPRECATED//);
++$deprecated if($deprecated > 0 && /^#\s*if/);
--$deprecated if($deprecated > 0 && /^#\s*endif/);
next if($deprecated > 0);
# filter single-line comments
s/\/\*.*\*\///g;
# begin of multiline comment
if(/\/\*/)
{
$comment = 1;
next;
}
s/','/\%\%COMMA\%\%/;
s/'}'/\%\%RBRACE\%\%/;
if (/^\s*typedef enum/ )
{
print ";; From $file\n\n" if (!$from);
$from=1;
$enum=1;
next;
}
if ($enum && /\}/)
{
$enum=0;
&process($line,$_);
$line="";
}
$line.=$_ if ($enum);
}
}
# convert enums to lisp
sub process
{
my ($line,$def)=@_;
$def=~s/\s*\}\s*//g;
$def=~s/\s*;\s*$//;
my $c_name=$def;
$line=~s/\s+/ /g;
$line=~s/\/\*.*\*\///g;
$line=~s/\s*{\s*//;
my $entity = "enum";
$c_name =~ /^([A-Z][a-z]*)/;
$module = $1;
$def =~ s/$module//;
@c_name=();
@name=();
@number=();
$val=0;
foreach $i (split(/,/,$line))
{
$i=~s/^\s+//;
$i=~s/\s+$//;
if ($i =~ /^\S+$/)
{
push(@c_name,$i);
push(@number,sprintf("%d",$val));
$token{$i}=$val;
}
elsif ($i =~ /^(\S+)\s*=\s*(0x[0-9a-fA-F]+)$/ ||
$i =~ /^(\S+)\s*=\s*(-?[0-9]+)$/ ||
$i =~ /^(\S+)\s*=\s*(1\s*<<\s*[0-9]+)$/
)
{
my ($tmp1, $tmp2) = ($1, $2);
push(@c_name, $tmp1);
eval("\$val = $tmp2;");
$entity = "flags" if($tmp2 =~ /^1\s*<</ || $tmp2 =~ /^0x/);
push(@number, $tmp2);
$token{$tmp1} = $tmp2;
}
elsif ($i =~ /^(\S+)\s*=\s*([ _x0-9a-fA-Z|()~]+)$/)
{
my ($tmp1, $tmp2) = ($1, $2);
push(@c_name, $tmp1);
$tmp2 =~ s/([A-Z_]+)/($token{$1})/;
eval("\$val = $tmp2;");
$val = "#error" if(!$val);
$val = sprintf("0x%X", $val) if($entity eq "flags");
push(@number, $val);
$token{$tmp1} = $val;
}
elsif ($i =~ /^(\S+)\s*=\s*'(.)'$/)
{
push(@c_name,$1);
push(@number,"\'$2\'");
$val=ord($2);
$token{$1}=$val;
}
elsif ($i =~ /^(\S+)\s*=\s*(\%\%[A-Z]+\%\%)$/)
{
$tmp=$1;
$_=$2;
s/\%\%COMMA\%\%/,/;
s/\%\%RBRACE\%\%/]/;
push(@c_name,$tmp);
push(@number,"\'$_\'");
$val=ord($_);
$token{$tmp}=$val;
}
else
{
#print STDERR "$i\n";
}
$val++;
}
# remove the prefix to form names
&form_names(\@name,\@c_name);
my $format = "%d";
$format = "0x%X" if($entity eq "flags");
# evaluate any unevaluated values
my $j;
for ($j=0;$j<$#number+1;$j++)
{
if ($number[$j]=~/\$/)
{
$number[$j]=sprintf($format, eval($number[$j]));
}
}
#print ";; Enum $def\n\n";
print "(define-$entity-extended $def\n";
print " (in-module \"$module\")\n";
print " (c-name \"$c_name\")\n";
print " (values\n";
for ($j=0;$j<$#c_name+1;$j++)
{
print " \'(\"$name[$j]\" \"$c_name[$j]\"";
print " \"$number[$j]\"" if ($number[$j] ne "");
print ")\n";
}
print " )\n";
print ")\n\n";
}
sub form_names
{
my ($name,$c_name)=@_;
my $len=length($$c_name[0]) - 1;
my $j;
NAME: for ($j=0;$j<$#c_name;$j++)
{
while (substr($$c_name[$j],$len-1,1) ne "_" ||
substr($$c_name[$j],0,$len) ne substr($$c_name[$j+1],0,$len))
{
$len--;
last NAME if ($len <= 0);
}
#print substr($$c_name[$j],0,$len),"\n";
}
my $prefix=substr($$c_name[0],0,$len);
for ($j=0;$j<$#c_name+1;$j++)
{
$_=$$c_name[$j];
s/^$prefix//;
tr/A-Z_/a-z-/;
push(@$name,$_);
}
}

View file

@ -0,0 +1,29 @@
# Build the library, to be installed and used by other defs-generating code:
files_h = generate_extra_defs.h
files_cc = generate_extra_defs.cc
if PLATFORM_WIN32
no_undefined = -no-undefined
else
no_undefined =
endif
lib_LTLIBRARIES = libglibmm_generate_extra_defs-2.4.la
libglibmm_generate_extra_defs_2_4_la_SOURCES = $(files_h) $(files_cc)
libglibmm_generate_extra_defs_2_4_la_LDFLAGS = $(no_undefined) -version-info $(LIBGLIBMM_SO_VERSION)
libglibmm_generate_extra_defs_2_4_la_LIBADD = $(GLIBMM_LIBS)
sublib_includedir = $(includedir)/glibmm-2.4/glibmm_generate_extra_defs
sublib_include_HEADERS = $(files_h)
# Build the generate_properties_defs utility executable.
# This is not used to build the rest of glibmm.
INCLUDES = $(GLIBMM_CFLAGS)
LIBS = $(GLIBMM_LIBS)
noinst_PROGRAMS = generate_extra_defs
generate_extra_defs_SOURCES = generate_defs_glib.cc
generate_extra_defs_LDADD = libglibmm_generate_extra_defs-2.4.la

View file

@ -0,0 +1,568 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Build the library, to be installed and used by other defs-generating code:
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
noinst_PROGRAMS = generate_extra_defs$(EXEEXT)
subdir = tools/extra_defs_gen
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(sublib_include_HEADERS)
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/scripts/c_std.m4 \
$(top_srcdir)/scripts/cxx.m4 $(top_srcdir)/scripts/cxx_std.m4 \
$(top_srcdir)/scripts/docgen.m4 \
$(top_srcdir)/scripts/glibmm_check_perl.m4 \
$(top_srcdir)/scripts/macros.m4 \
$(top_srcdir)/scripts/reduced.m4 $(top_srcdir)/scripts/sun.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/glib/glibmmconfig.h
CONFIG_CLEAN_FILES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(libdir)" \
"$(DESTDIR)$(sublib_includedir)"
libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libglibmm_generate_extra_defs_2_4_la_DEPENDENCIES = \
$(am__DEPENDENCIES_1)
am__objects_1 =
am__objects_2 = generate_extra_defs.lo
am_libglibmm_generate_extra_defs_2_4_la_OBJECTS = $(am__objects_1) \
$(am__objects_2)
libglibmm_generate_extra_defs_2_4_la_OBJECTS = \
$(am_libglibmm_generate_extra_defs_2_4_la_OBJECTS)
libglibmm_generate_extra_defs_2_4_la_LINK = $(LIBTOOL) --tag=CXX \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \
$(AM_CXXFLAGS) $(CXXFLAGS) \
$(libglibmm_generate_extra_defs_2_4_la_LDFLAGS) $(LDFLAGS) -o \
$@
PROGRAMS = $(noinst_PROGRAMS)
am_generate_extra_defs_OBJECTS = generate_defs_glib.$(OBJEXT)
generate_extra_defs_OBJECTS = $(am_generate_extra_defs_OBJECTS)
generate_extra_defs_DEPENDENCIES = \
libglibmm_generate_extra_defs-2.4.la
DEFAULT_INCLUDES = -I. -I$(top_builddir) -I$(top_builddir)/glib@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
am__depfiles_maybe = depfiles
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libglibmm_generate_extra_defs_2_4_la_SOURCES) \
$(generate_extra_defs_SOURCES)
DIST_SOURCES = $(libglibmm_generate_extra_defs_2_4_la_SOURCES) \
$(generate_extra_defs_SOURCES)
sublib_includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(sublib_include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISABLE_DEPRECATED_API_CFLAGS = @DISABLE_DEPRECATED_API_CFLAGS@
DISABLE_DEPRECATED_CFLAGS = @DISABLE_DEPRECATED_CFLAGS@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GLIBMM_CFLAGS = @GLIBMM_CFLAGS@
GLIBMM_LIBS = @GLIBMM_LIBS@
GLIBMM_MAJOR_VERSION = @GLIBMM_MAJOR_VERSION@
GLIBMM_MICRO_VERSION = @GLIBMM_MICRO_VERSION@
GLIBMM_MINOR_VERSION = @GLIBMM_MINOR_VERSION@
GLIBMM_RELEASE = @GLIBMM_RELEASE@
GLIBMM_VERSION = @GLIBMM_VERSION@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTKMMPROC_MERGECDOCS = @GTKMMPROC_MERGECDOCS@
GTKMM_DOXYGEN_INPUT = @GTKMM_DOXYGEN_INPUT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBGLIBMM_SO_VERSION = @LIBGLIBMM_SO_VERSION@
LIBOBJS = @LIBOBJS@
LIBS = $(GLIBMM_LIBS)
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL_PATH = @PERL_PATH@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
files_h = generate_extra_defs.h
files_cc = generate_extra_defs.cc
@PLATFORM_WIN32_FALSE@no_undefined =
@PLATFORM_WIN32_TRUE@no_undefined = -no-undefined
lib_LTLIBRARIES = libglibmm_generate_extra_defs-2.4.la
libglibmm_generate_extra_defs_2_4_la_SOURCES = $(files_h) $(files_cc)
libglibmm_generate_extra_defs_2_4_la_LDFLAGS = $(no_undefined) -version-info $(LIBGLIBMM_SO_VERSION)
libglibmm_generate_extra_defs_2_4_la_LIBADD = $(GLIBMM_LIBS)
sublib_includedir = $(includedir)/glibmm-2.4/glibmm_generate_extra_defs
sublib_include_HEADERS = $(files_h)
# Build the generate_properties_defs utility executable.
# This is not used to build the rest of glibmm.
INCLUDES = $(GLIBMM_CFLAGS)
generate_extra_defs_SOURCES = generate_defs_glib.cc
generate_extra_defs_LDADD = libglibmm_generate_extra_defs-2.4.la
all: all-am
.SUFFIXES:
.SUFFIXES: .cc .lo .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/extra_defs_gen/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tools/extra_defs_gen/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
f=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
$(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
p=$(am__strip_dir) \
echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
$(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
libglibmm_generate_extra_defs-2.4.la: $(libglibmm_generate_extra_defs_2_4_la_OBJECTS) $(libglibmm_generate_extra_defs_2_4_la_DEPENDENCIES)
$(libglibmm_generate_extra_defs_2_4_la_LINK) -rpath $(libdir) $(libglibmm_generate_extra_defs_2_4_la_OBJECTS) $(libglibmm_generate_extra_defs_2_4_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
echo " rm -f $$p $$f"; \
rm -f $$p $$f ; \
done
generate_extra_defs$(EXEEXT): $(generate_extra_defs_OBJECTS) $(generate_extra_defs_DEPENDENCIES)
@rm -f generate_extra_defs$(EXEEXT)
$(CXXLINK) $(generate_extra_defs_OBJECTS) $(generate_extra_defs_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate_defs_glib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generate_extra_defs.Plo@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cc.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cc.lo:
@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-sublib_includeHEADERS: $(sublib_include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(sublib_includedir)" || $(MKDIR_P) "$(DESTDIR)$(sublib_includedir)"
@list='$(sublib_include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(sublib_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(sublib_includedir)/$$f'"; \
$(sublib_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(sublib_includedir)/$$f"; \
done
uninstall-sublib_includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(sublib_include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(sublib_includedir)/$$f'"; \
rm -f "$(DESTDIR)$(sublib_includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(sublib_includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-sublib_includeHEADERS
install-dvi: install-dvi-am
install-exec-am: install-libLTLIBRARIES
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-libLTLIBRARIES uninstall-sublib_includeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool clean-noinstPROGRAMS ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-libLTLIBRARIES install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
install-sublib_includeHEADERS installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-libLTLIBRARIES \
uninstall-sublib_includeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,34 @@
/* $Id: generate_defs_glib.cc 29 2003-04-19 12:39:06Z murrayc $ */
/* generate_defs_gtk.cc
*
* Copyright (C) 2001 The Free Software Foundation
*
* This library 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 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "generate_extra_defs.h"
//#include <glib/glib.h>
int main (int, char**)
{
//glib_init(&argc, &argv);
//std::cout << get_defs( ATK_TYPE_HYPERLINK )
std::cout << "No glib types were examined.";
return 0;
}

View file

@ -0,0 +1,217 @@
/* $Id: generate_extra_defs.cc 204 2005-02-13 14:30:19Z murrayc $ */
/* generate_extra_defs.cc
*
* Copyright (C) 2001 The Free Software Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "generate_extra_defs.h"
std::string get_properties(GType gtype)
{
std::string strResult;
std::string strObjectName = g_type_name(gtype);
//Get the list of properties:
GObjectClass* pGClass = G_OBJECT_CLASS(g_type_class_ref(gtype));
guint iCount = 0;
GParamSpec** ppParamSpec = g_object_class_list_properties (pGClass, &iCount);
for(guint i = 0; i < iCount; i++)
{
GParamSpec* pParamSpec = ppParamSpec[i];
if(pParamSpec)
{
//Name and type:
std::string strName = g_param_spec_get_name(pParamSpec);
std::string strTypeName = G_PARAM_SPEC_TYPE_NAME(pParamSpec);
const gchar* pchBlurb = g_param_spec_get_blurb(pParamSpec);
std::string strDocs = (pchBlurb ? pchBlurb : std::string());
strResult += "(define-property " + strName + "\n";
strResult += " (of-object \"" + strObjectName + "\")\n";
strResult += " (prop-type \"" + strTypeName + "\")\n";
strResult += " (docs \"" + strDocs + "\")\n";
//Flags:
GParamFlags flags = pParamSpec->flags;
bool bReadable = (flags & G_PARAM_READABLE) == G_PARAM_READABLE;
bool bWritable = (flags & G_PARAM_WRITABLE) == G_PARAM_WRITABLE;
bool bConstructOnly = (flags & G_PARAM_CONSTRUCT_ONLY) == G_PARAM_CONSTRUCT_ONLY;
//#t and #f aren't documented, but I guess that it's correct based on the example in the .defs spec.
const std::string strTrue = "#t";
const std::string strFalse = "#f";
strResult += " (readable " + (bReadable ? strTrue : strFalse) + ")\n";
strResult += " (writable " + (bWritable ? strTrue : strFalse) + ")\n";
strResult += " (construct-only " + (bConstructOnly ? strTrue : strFalse) + ")\n";
strResult += ")\n\n"; //close (define-property
}
}
g_free(ppParamSpec);
g_type_class_unref(pGClass); //to match the g_type_class_ref() above.
return strResult;
}
std::string get_type_name(GType gtype) //Adds a * if necessary.
{
std::string strTypeName = g_type_name(gtype);
if( g_type_is_a(gtype, G_TYPE_OBJECT) || g_type_is_a(gtype, G_TYPE_BOXED) )
strTypeName += "*"; //Add * to show that it's a pointer.
else if( g_type_is_a(gtype, G_TYPE_STRING) )
strTypeName = "gchar*"; //g_type_name() returns "gchararray".
return strTypeName;
}
std::string get_type_name_parameter(GType gtype)
{
std::string strTypeName = get_type_name(gtype);
//All signal parameters that are registered as GTK_TYPE_STRING are actually const gchar*.
if(strTypeName == "gchar*")
strTypeName = "const-gchar*";
return strTypeName;
}
std::string get_type_name_signal(GType gtype)
{
return get_type_name_parameter(gtype); //At the moment, it needs the same stuff.
}
std::string get_signals(GType gtype)
{
std::string strResult;
std::string strObjectName = g_type_name(gtype);
gpointer gclass_ref = 0;
if(G_TYPE_IS_OBJECT(gtype))
gclass_ref = g_type_class_ref(gtype); //Ensures that class_init() is called.
//Get the list of signals:
guint iCount = 0;
guint* pIDs = g_signal_list_ids (gtype, &iCount);
//Loop through the list of signals:
if(pIDs)
{
for(guint i = 0; i < iCount; i++)
{
guint signal_id = pIDs[i];
//Name:
std::string strName = g_signal_name(signal_id);
strResult += "(define-signal " + strName + "\n";
strResult += " (of-object \"" + strObjectName + "\")\n";
//Other information about the signal:
GSignalQuery signalQuery = { 0, 0, 0, GSignalFlags(0), 0, 0, 0, };
g_signal_query(signal_id, &signalQuery);
//Return type:
std::string strReturnTypeName = get_type_name_signal( signalQuery.return_type & ~G_SIGNAL_TYPE_STATIC_SCOPE ); //The type is mangled with a flag. Hacky.
//bool bReturnTypeHasStaticScope = (signalQuery.return_type & G_SIGNAL_TYPE_STATIC_SCOPE) == G_SIGNAL_TYPE_STATIC_SCOPE;
strResult += " (return-type \"" + strReturnTypeName + "\")\n";
//When:
{
bool bWhenFirst = (signalQuery.signal_flags & G_SIGNAL_RUN_FIRST) == G_SIGNAL_RUN_FIRST;
bool bWhenLast = (signalQuery.signal_flags & G_SIGNAL_RUN_LAST) == G_SIGNAL_RUN_LAST;
std::string strWhen = "unknown";
if(bWhenFirst && bWhenLast)
strWhen = "both";
else if(bWhenFirst)
strWhen = "first";
else if(bWhenLast)
strWhen = "last";
strResult += " (when \"" + strWhen + "\")\n";
}
//Loop through the list of parameters:
const GType* pParameters = signalQuery.param_types;
if(pParameters)
{
strResult += " (parameters\n";
for(unsigned i = 0; i < signalQuery.n_params; i++)
{
GType typeParamMangled = pParameters[i];
//Parameter name:
//TODO: How can we get the real parameter name?
gchar* pchNum = g_strdup_printf("%d", i);
std::string strParamName = "p" + std::string(pchNum);
g_free(pchNum);
pchNum = 0;
//Just like above, for the return type:
std::string strTypeName = get_type_name_signal( typeParamMangled & ~G_SIGNAL_TYPE_STATIC_SCOPE ); //The type is mangled with a flag. Hacky.
//bool bReturnTypeHasStaticScope = (typeParamMangled & G_SIGNAL_TYPE_STATIC_SCOPE) == G_SIGNAL_TYPE_STATIC_SCOPE;
strResult += " '(\"" + strTypeName + "\" \"" + strParamName + "\")\n";
}
strResult += " )\n"; //close (properties
}
strResult += ")\n\n"; //close (define=signal
}
}
g_free(pIDs);
if(gclass_ref)
g_type_class_unref(gclass_ref); //to match the g_type_class_ref() above.
return strResult;
}
std::string get_defs(GType gtype)
{
std::string strObjectName = g_type_name(gtype);
std::string strDefs = ";; From " + strObjectName + "\n\n";
strDefs += get_signals(gtype);
if(G_TYPE_IS_OBJECT(gtype))
strDefs += get_properties(gtype);
return strDefs;
}

View file

@ -0,0 +1,33 @@
/* $Id: generate_extra_defs.h 2 2003-01-07 16:59:16Z murrayc $ */
/* generate_extra_defs.h
*
* Copyright (C) 2001 The Free Software Foundation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <glib-object.h>
#include <iostream>
#include <string>
std::string get_defs(GType gtype);
std::string get_properties(GType gtype);
std::string get_type_name(GType gtype);
std::string get_type_name_parameter(GType gtype);
std::string get_type_name_signal(GType gtype);
std::string get_signals(GType gtype);

View file

@ -0,0 +1,392 @@
#! /usr/bin/perl
#
# tools/generate_wrap_init.pl. Generated from generate_wrap_init.pl.in by configure.
#
use strict;
my @namespace_whole = (); # list of strings.
my $function_prefix = "";
my $parent_dir = ""; # e.g. gtkmm
my $path = "gtk--";
my $debug = 0;
my @filenames_headers = ();
my %objects = ();
my %exceptions = ();
my %namespaces = (); # hashmap of lists of strings.
my %basenames = ();
my %win32_nowrap = ();
my %deprecated = ();
# Loop through command line arguments, setting variables:
while ($ARGV[0] =~ /^-/)
{
if ($ARGV[0] =~ /--namespace=(\S+)/)
{
push(@namespace_whole, $1);
if($parent_dir eq "")
{ $parent_dir = lc($1) . "mm"; }
}
elsif ($ARGV[0] =~ /--function_prefix=(\S+)/)
{
$function_prefix = "$1";
}
elsif ($ARGV[0] =~ /--parent_dir=(\S+)/)
{
$parent_dir = "$1";
}
elsif
(
$ARGV[0] =~ /--debug/) {$debug = 1;
}
elsif ($ARGV[0] =~ /--path=(\S+)/)
{
$path = "$1";
}
else
{
print "Error: unknown option $ARGV[0]\n";
exit;
}
shift @ARGV;
}
while ($ARGV[0])
{
if ($debug) {warn "Processing file : $ARGV[0]\n";}
my $filename = $ARGV[0];
open FILE, $filename or die "Couldn't open file $ARGV[0] : $!\n";
# my $file = $ARGV[0];
# $file =~ s/.*\/([^\/]+)$/$1/;
# $file =~ s/\.hg//;
my @tmpnamespace = @namespace_whole;
my $cppname = "";
my $cname = "";
my $ccast = "";
while (<FILE>)
{
if (/CLASS_START\((\w+)\)/) #We need a new way to get the namespace.
{
print "generate_wrap_init: namespace found: $1\n";
push(@tmpnamespace, $1);
}
elsif (/_CLASS_GOBJECT\s*\(/) #TODO: There is duplication of code here.
{
my $line = $_;
while ($line !~ /\)/ && ($_ = <FILE>))
{
$line .= $_;
}
$line =~ s/^.*_CLASS_GOBJECT\s*\(//;
$line =~ s/\s+//g;
($cppname, $cname, $ccast) = split(/,/, $line);
$objects{$cppname} = $cname;
@{$namespaces{$cppname}} = ( @tmpnamespace ); #both are lists of strings
$basenames{$cppname} = lc($ccast);
}
elsif (/_CLASS_GTKOBJECT\s*\(/)
{
my $line = $_;
while ($line !~ /\)/ && ($_ = <FILE>))
{
$line .= $_;
}
$line =~ s/^.*_CLASS_GTKOBJECT\s*\(//;
$line =~ s/\s+//g;
($cppname, $cname, $ccast) = split(/,/, $line);
#TODO: Remove this hack eventually.
if( ($cname ne "GtkTree") && ($cname ne "GtkTreeItem") && ($cname ne "GtkText") )
{
$objects{$cppname} = $cname;
@{$namespaces{$cppname}} = ( @tmpnamespace ); #both are lists of strings
$basenames{$cppname} = lc($ccast);
}
}
elsif (/_WRAP_GERROR\s*\(/) #TODO: There is duplication of code here.
{
my $line = $_;
while ($line !~ /\)/ && ($_ = <FILE>))
{
$line .= $_;
}
$line =~ s/^.*_WRAP_GERROR\s*\(//;
$line =~ s/\s+//g;
$line =~ s/\)//;
($cppname, $cname, $ccast) = split(/,/, $line);
$exceptions{$cppname} = $cname;
@{$namespaces{$cppname}} = ( @tmpnamespace ); #both are lists of strings
$basenames{$cppname} = lc($ccast);
}
elsif (/_GTKMMPROC_WIN32_NO_WRAP/)
{
$win32_nowrap{$cppname} = 1;
}
elsif (/_IS_DEPRECATED/)
{
$deprecated{$cppname} = 1;
}
}
# Store header filename so that we can #include it later:
my $filename_header = $filename;
$filename_header =~ s/.*\/([^\/]+)\.hg/$1.h/;
push(@filenames_headers, $filename_header);
shift @ARGV;
close(FILE);
}
# my $namespace_whole_lower = lc($namespace_whole);
print << "EOF";
#include <glib.h>
// Disable the 'const' function attribute of the get_type() functions.
// GCC would optimize them out because we don't use the return value.
#undef G_GNUC_CONST
#define G_GNUC_CONST /* empty */
#include <${parent_dir}/wrap_init.h>
#include <glibmm/error.h>
#include <glibmm/object.h>
// #include the widget headers so that we can call the get_type() static methods:
EOF
foreach( @filenames_headers )
{
print "#include \"" . $_ . "\"\n";
}
print "\n";
# Here we have to be subtle. The gtkmm objects are easy, they all go
# into the Gtk namespace. But in gnomemm, some go into the Gnome
# namespace (most of them), and some into the Gtk one (because the
# corresponding widget is Gtk-prefixed, e.g. GtkTed, GtkDial, etc...
# First, the Gtk namespace
print "extern \"C\"\n";
print "{\n";
print "\n//Declarations of the *_get_type() functions:\n\n";
my $i = 0;
foreach $i (sort keys %objects)
{
if( $deprecated{$i} eq 1 )
{
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
}
#On Win32, these classes are not compiled:
if( $win32_nowrap{$i} eq 1 )
{
print "#ifndef G_OS_WIN32\n"
}
print "GType $basenames{$i}_get_type(void);\n";
if( $win32_nowrap{$i} eq 1 )
{
print "#endif //G_OS_WIN32\n"
}
if( $deprecated{$i} eq 1 )
{
print "#endif // *_DISABLE_DEPRECATED\n"
}
}
print "\n//Declarations of the *_error_quark() functions:\n\n";
my $i = 0;
foreach $i (sort keys %exceptions)
{
print "GQuark $basenames{$i}_quark(void);\n";
}
print "} // extern \"C\"\n";
print "\n";
print "\n//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers:\n\n";
my $i = 0;
foreach $i (sort keys %objects)
{
if( $deprecated{$i} eq 1 )
{
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
}
#On Win32, these classes are not compiled:
if( $win32_nowrap{$i} eq 1 )
{
print "#ifndef G_OS_WIN32\n"
}
my $namespace_declarations = "";
my $namespace_close = "";
foreach ( @{$namespaces{$i}} )
{
$namespace_declarations .= "namespace $_ { ";
$namespace_close .= " }";
}
print "${namespace_declarations} class ${i}_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; ${namespace_close}\n";
if( $win32_nowrap{$i} eq 1 )
{
print "#endif //G_OS_WIN32\n"
}
if( $deprecated{$i} eq 1 )
{
print "#endif // *_DISABLE_DEPRECATED\n"
}
}
# print "\n//Declarations of the *Error::throw_func() methods:\n\n";
#
# my $i = 0;
# foreach $i (sort keys %exceptions)
# {
# my $namespace_declarations = "";
# my $namespace_close = "";
# foreach ( @{$namespaces{$i}} )
# {
# $namespace_declarations .= "namespace $_ { ";
# $namespace_close .= " }";
# }
#
# print "${namespace_declarations} class ${i} { public: static void throw_func(GError*); }; ${namespace_close}\n";
# }
my $namespace_whole_declarations = "";
my $namespace_whole_close = "";
foreach( @namespace_whole )
{
$namespace_whole_declarations .= "namespace " . $_ ." { ";
$namespace_whole_close = "} //" . $_ . "\n" . $namespace_whole_close;
}
print "\n";
print "$namespace_whole_declarations\n";
print "\n";
print "void " .$function_prefix . "wrap_init()\n{\n";
# Generate namespace::wrap_init() body
#
print " // Register Error domains:\n";
foreach $i (sort keys %exceptions)
{
my $namespace_prefix = "";
foreach( @{$namespaces{$i}} )
{
$namespace_prefix .= $_ ."::";
}
print " Glib::Error::register_domain($basenames{$i}_quark(), &", "${namespace_prefix}${i}::throw_func);\n";
}
print "\n";
print "// Map gtypes to gtkmm wrapper-creation functions:\n";
foreach $i (sort keys %objects)
{
if( $deprecated{$i} eq 1 )
{
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
}
#On Win32, these classes are not compiled:
if( $win32_nowrap{$i} eq 1 )
{
print "#ifndef G_OS_WIN32\n"
}
my $namespace_prefix = "";
foreach( @{$namespaces{$i}} )
{
$namespace_prefix .= $_ ."::";
}
print " Glib::wrap_register($basenames{$i}_get_type(), &", "${namespace_prefix}${i}_Class::wrap_new);\n";
if( $win32_nowrap{$i} eq 1 )
{
print "#endif //G_OS_WIN32\n"
}
if( $deprecated{$i} eq 1 )
{
print "#endif // *_DISABLE_DEPRECATED\n"
}
}
print "\n";
print " // Register the gtkmm gtypes:\n";
foreach $i (sort keys %objects)
{
if( $deprecated{$i} eq 1 )
{
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
}
#On Win32, these classes are not compiled:
if( $win32_nowrap{$i} eq 1 )
{
print "#ifndef G_OS_WIN32\n"
}
my $namespace_prefix = "";
foreach( @{$namespaces{$i}} )
{
$namespace_prefix .= $_ ."::";
}
print " ${namespace_prefix}${i}::get_type();\n";
if( $win32_nowrap{$i} eq 1 )
{
print "#endif //G_OS_WIN32\n"
}
if( $deprecated{$i} eq 1 )
{
print "#endif // *_DISABLE_DEPRECATED\n"
}
}
print << "EOF";
} // wrap_init()
$namespace_whole_close
EOF
exit 0;

View file

@ -0,0 +1,392 @@
#! @PERL_PATH@
#
# @configure_input@
#
use strict;
my @namespace_whole = (); # list of strings.
my $function_prefix = "";
my $parent_dir = ""; # e.g. gtkmm
my $path = "gtk--";
my $debug = 0;
my @filenames_headers = ();
my %objects = ();
my %exceptions = ();
my %namespaces = (); # hashmap of lists of strings.
my %basenames = ();
my %win32_nowrap = ();
my %deprecated = ();
# Loop through command line arguments, setting variables:
while ($ARGV[0] =~ /^-/)
{
if ($ARGV[0] =~ /--namespace=(\S+)/)
{
push(@namespace_whole, $1);
if($parent_dir eq "")
{ $parent_dir = lc($1) . "mm"; }
}
elsif ($ARGV[0] =~ /--function_prefix=(\S+)/)
{
$function_prefix = "$1";
}
elsif ($ARGV[0] =~ /--parent_dir=(\S+)/)
{
$parent_dir = "$1";
}
elsif
(
$ARGV[0] =~ /--debug/) {$debug = 1;
}
elsif ($ARGV[0] =~ /--path=(\S+)/)
{
$path = "$1";
}
else
{
print "Error: unknown option $ARGV[0]\n";
exit;
}
shift @ARGV;
}
while ($ARGV[0])
{
if ($debug) {warn "Processing file : $ARGV[0]\n";}
my $filename = $ARGV[0];
open FILE, $filename or die "Couldn't open file $ARGV[0] : $!\n";
# my $file = $ARGV[0];
# $file =~ s/.*\/([^\/]+)$/$1/;
# $file =~ s/\.hg//;
my @tmpnamespace = @namespace_whole;
my $cppname = "";
my $cname = "";
my $ccast = "";
while (<FILE>)
{
if (/CLASS_START\((\w+)\)/) #We need a new way to get the namespace.
{
print "generate_wrap_init: namespace found: $1\n";
push(@tmpnamespace, $1);
}
elsif (/_CLASS_GOBJECT\s*\(/) #TODO: There is duplication of code here.
{
my $line = $_;
while ($line !~ /\)/ && ($_ = <FILE>))
{
$line .= $_;
}
$line =~ s/^.*_CLASS_GOBJECT\s*\(//;
$line =~ s/\s+//g;
($cppname, $cname, $ccast) = split(/,/, $line);
$objects{$cppname} = $cname;
@{$namespaces{$cppname}} = ( @tmpnamespace ); #both are lists of strings
$basenames{$cppname} = lc($ccast);
}
elsif (/_CLASS_GTKOBJECT\s*\(/)
{
my $line = $_;
while ($line !~ /\)/ && ($_ = <FILE>))
{
$line .= $_;
}
$line =~ s/^.*_CLASS_GTKOBJECT\s*\(//;
$line =~ s/\s+//g;
($cppname, $cname, $ccast) = split(/,/, $line);
#TODO: Remove this hack eventually.
if( ($cname ne "GtkTree") && ($cname ne "GtkTreeItem") && ($cname ne "GtkText") )
{
$objects{$cppname} = $cname;
@{$namespaces{$cppname}} = ( @tmpnamespace ); #both are lists of strings
$basenames{$cppname} = lc($ccast);
}
}
elsif (/_WRAP_GERROR\s*\(/) #TODO: There is duplication of code here.
{
my $line = $_;
while ($line !~ /\)/ && ($_ = <FILE>))
{
$line .= $_;
}
$line =~ s/^.*_WRAP_GERROR\s*\(//;
$line =~ s/\s+//g;
$line =~ s/\)//;
($cppname, $cname, $ccast) = split(/,/, $line);
$exceptions{$cppname} = $cname;
@{$namespaces{$cppname}} = ( @tmpnamespace ); #both are lists of strings
$basenames{$cppname} = lc($ccast);
}
elsif (/_GTKMMPROC_WIN32_NO_WRAP/)
{
$win32_nowrap{$cppname} = 1;
}
elsif (/_IS_DEPRECATED/)
{
$deprecated{$cppname} = 1;
}
}
# Store header filename so that we can #include it later:
my $filename_header = $filename;
$filename_header =~ s/.*\/([^\/]+)\.hg/$1.h/;
push(@filenames_headers, $filename_header);
shift @ARGV;
close(FILE);
}
# my $namespace_whole_lower = lc($namespace_whole);
print << "EOF";
#include <glib.h>
// Disable the 'const' function attribute of the get_type() functions.
// GCC would optimize them out because we don't use the return value.
#undef G_GNUC_CONST
#define G_GNUC_CONST /* empty */
#include <${parent_dir}/wrap_init.h>
#include <glibmm/error.h>
#include <glibmm/object.h>
// #include the widget headers so that we can call the get_type() static methods:
EOF
foreach( @filenames_headers )
{
print "#include \"" . $_ . "\"\n";
}
print "\n";
# Here we have to be subtle. The gtkmm objects are easy, they all go
# into the Gtk namespace. But in gnomemm, some go into the Gnome
# namespace (most of them), and some into the Gtk one (because the
# corresponding widget is Gtk-prefixed, e.g. GtkTed, GtkDial, etc...
# First, the Gtk namespace
print "extern \"C\"\n";
print "{\n";
print "\n//Declarations of the *_get_type() functions:\n\n";
my $i = 0;
foreach $i (sort keys %objects)
{
if( $deprecated{$i} eq 1 )
{
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
}
#On Win32, these classes are not compiled:
if( $win32_nowrap{$i} eq 1 )
{
print "#ifndef G_OS_WIN32\n"
}
print "GType $basenames{$i}_get_type(void);\n";
if( $win32_nowrap{$i} eq 1 )
{
print "#endif //G_OS_WIN32\n"
}
if( $deprecated{$i} eq 1 )
{
print "#endif // *_DISABLE_DEPRECATED\n"
}
}
print "\n//Declarations of the *_error_quark() functions:\n\n";
my $i = 0;
foreach $i (sort keys %exceptions)
{
print "GQuark $basenames{$i}_quark(void);\n";
}
print "} // extern \"C\"\n";
print "\n";
print "\n//Declarations of the *_Class::wrap_new() methods, instead of including all the private headers:\n\n";
my $i = 0;
foreach $i (sort keys %objects)
{
if( $deprecated{$i} eq 1 )
{
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
}
#On Win32, these classes are not compiled:
if( $win32_nowrap{$i} eq 1 )
{
print "#ifndef G_OS_WIN32\n"
}
my $namespace_declarations = "";
my $namespace_close = "";
foreach ( @{$namespaces{$i}} )
{
$namespace_declarations .= "namespace $_ { ";
$namespace_close .= " }";
}
print "${namespace_declarations} class ${i}_Class { public: static Glib::ObjectBase* wrap_new(GObject*); }; ${namespace_close}\n";
if( $win32_nowrap{$i} eq 1 )
{
print "#endif //G_OS_WIN32\n"
}
if( $deprecated{$i} eq 1 )
{
print "#endif // *_DISABLE_DEPRECATED\n"
}
}
# print "\n//Declarations of the *Error::throw_func() methods:\n\n";
#
# my $i = 0;
# foreach $i (sort keys %exceptions)
# {
# my $namespace_declarations = "";
# my $namespace_close = "";
# foreach ( @{$namespaces{$i}} )
# {
# $namespace_declarations .= "namespace $_ { ";
# $namespace_close .= " }";
# }
#
# print "${namespace_declarations} class ${i} { public: static void throw_func(GError*); }; ${namespace_close}\n";
# }
my $namespace_whole_declarations = "";
my $namespace_whole_close = "";
foreach( @namespace_whole )
{
$namespace_whole_declarations .= "namespace " . $_ ." { ";
$namespace_whole_close = "} //" . $_ . "\n" . $namespace_whole_close;
}
print "\n";
print "$namespace_whole_declarations\n";
print "\n";
print "void " .$function_prefix . "wrap_init()\n{\n";
# Generate namespace::wrap_init() body
#
print " // Register Error domains:\n";
foreach $i (sort keys %exceptions)
{
my $namespace_prefix = "";
foreach( @{$namespaces{$i}} )
{
$namespace_prefix .= $_ ."::";
}
print " Glib::Error::register_domain($basenames{$i}_quark(), &", "${namespace_prefix}${i}::throw_func);\n";
}
print "\n";
print "// Map gtypes to gtkmm wrapper-creation functions:\n";
foreach $i (sort keys %objects)
{
if( $deprecated{$i} eq 1 )
{
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
}
#On Win32, these classes are not compiled:
if( $win32_nowrap{$i} eq 1 )
{
print "#ifndef G_OS_WIN32\n"
}
my $namespace_prefix = "";
foreach( @{$namespaces{$i}} )
{
$namespace_prefix .= $_ ."::";
}
print " Glib::wrap_register($basenames{$i}_get_type(), &", "${namespace_prefix}${i}_Class::wrap_new);\n";
if( $win32_nowrap{$i} eq 1 )
{
print "#endif //G_OS_WIN32\n"
}
if( $deprecated{$i} eq 1 )
{
print "#endif // *_DISABLE_DEPRECATED\n"
}
}
print "\n";
print " // Register the gtkmm gtypes:\n";
foreach $i (sort keys %objects)
{
if( $deprecated{$i} eq 1 )
{
# The uc(parent_dir) is a bit of a hack. One day it will get it wrong.
print "#ifndef " . uc($parent_dir) ."_DISABLE_DEPRECATED\n"
}
#On Win32, these classes are not compiled:
if( $win32_nowrap{$i} eq 1 )
{
print "#ifndef G_OS_WIN32\n"
}
my $namespace_prefix = "";
foreach( @{$namespaces{$i}} )
{
$namespace_prefix .= $_ ."::";
}
print " ${namespace_prefix}${i}::get_type();\n";
if( $win32_nowrap{$i} eq 1 )
{
print "#endif //G_OS_WIN32\n"
}
if( $deprecated{$i} eq 1 )
{
print "#endif // *_DISABLE_DEPRECATED\n"
}
}
print << "EOF";
} // wrap_init()
$namespace_whole_close
EOF
exit 0;

View file

@ -0,0 +1,239 @@
#! @PERL_PATH@
#
# @configure_input@
#
######################################################################
# gmmproc (version 4)
######################################################################
#
# *** WARNING: Only modify gmmproc.in. gmmproc is built. ***
#
# Copyright 2001, Karl Einar Nelson, Murray Cumming
#
# 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.
#
#
# 'classes':
# WrapParser: steps through .hg and .ccg files, outputting appropriate m4 code with Outputter.
# Outputter: Used by WrapParser to ouput wrapper code. Ouputs *.g1 temp file and uses m4 to generate *.g2 from it. Then outputs .h and .cc files.
# Function: Contains information about C and C++ functions and signals.
#
######################################################################
########################## 'main()' ##################################
$main::procdir;
$main::m4path;
BEGIN {
# get prefix info from configure
my $prefix = "@prefix@";
my $exec_prefix = "@exec_prefix@";
my $libdir = "@libdir@";
# This line must match the install directory in m4/Makefile.am
$main::procdir = "$libdir/glibmm-2.4/proc";
$main::m4path = "@M4@";
# This line must match install dir from pm/Makefile.am
push @INC,"$main::procdir/pm";
}
use strict;
use warnings;
use Output;
use WrapParser;
# initialize globals
@main::macrodirs = ();
$main::srcdir = ".";
$main::defsdir = ".";
$main::source = "";
$main::debug = 0;
$main::unwrapped = 1;
{ # checking the environment for a set variable can trigger a warning
no warnings;
$main::debug = 1 if ($ENV{'GMMPROC_DEBUG'} eq 1);
}
# prototypes
sub parse_command_line_args();
#main()
parse_command_line_args();
my $objOutputter = &Output::new($main::m4path, \@main::macrodirs);
my $objWrapParser = &WrapParser::new($objOutputter);
$$objWrapParser{srcdir} = $main::srcdir;
$$objWrapParser{defsdir} = $main::defsdir;
$$objWrapParser{source} = $main::source;
$$objOutputter{source} = $main::source;
$$objOutputter{destdir} = $ARGV[1];
# Merge the C docs, e.g. gtk_docs.xml
# Suck the whole file into one big string, breaking it into tokens:
$objWrapParser->read_file($main::srcdir, $main::source);
# Parse output
$objWrapParser->parse_and_build_output();
# Write out *.g1 temporary file:
$objOutputter->output_temp_g1($$objWrapParser{module}); # e.g. "gtk"
# Execute m4 to get *.g2 file:
{
my $exitcode = $objOutputter->make_g2_from_g1();
if ($exitcode != 0)
{
if (!$main::debug)
{
$objOutputter->remove_temp_files();
}
print STDERR "m4 failed with exit code $exitcode. Aborting...\n";
exit ($exitcode);
}
}
# Section out the resulting output
$objOutputter->write_sections_to_files();
# Remove temp files.
if (!$main::debug)
{
$objOutputter->remove_temp_files();
}
#Warn about any unwrapped function/signals:
if ($main::unwrapped)
{
my @unwrapped = GtkDefs::get_unwrapped();
if (@unwrapped)
{
no warnings;
my @methods =
grep {$$_{entity_type} eq "method" & $$_{c_name}!~/^_/ } @unwrapped;
my @signals =
grep {$$_{entity_type} eq "signal"} @unwrapped;
my @properties =
grep {$$_{entity_type} eq "property"} @unwrapped;
if (@methods)
{
print "Unwrapped functions:\n";
map { print " $$_{c_name}\n"} @methods;
}
if (@properties)
{
print "Unwrapped properties:\n";
map { print " $$_{class}::$$_{name}\n"} @properties;
}
if (@signals)
{
print "Unwrapped signals:\n";
map { print " $$_{class}::$$_{name}\n"} @signals;
}
}
}
# end of program
exit();
####################################################################
sub print_usage()
{
print
'Usage: gmmproc [options] name srcdir destdir
-h
--help This usage message.
--doc Produces a header file for documentation. (FIXME)
--debug Leave intermediate output arround for analysis.
Alternatively, set GMMPROC_DEBUG=1 in the environment.
--unwrapped Warn about possible unwrapped functions.
--defs dir Change the directory to seach for defs.
-I dir Specify the directory with m4 files.
Note: This will read srcdir/name.{hg,ccg} file and generates destdir/name.cc
';
exit (1);
}
# void parse_command_line_args()
sub parse_command_line_args()
{
print_usage() if ($#ARGV == -1);
while ($#ARGV != -1)
{
$_ = shift @ARGV;
if (/^-/)
{
print_usage() if ( /^--help/);
print_usage() if ( /^-h/);
if (/^-I/)
{
push @main::macrodirs, shift @ARGV;
}
elsif (/^--unwrapped/)
{
$main::unwrapped = 1;
}
elsif (/^--defs/)
{
$main::defsdir = shift @ARGV;
}
elsif (/^--debug/)
{
$main::debug = 1;
}
else
{
print "unknown parameter $_\n";
}
next;
}
last;
}
# we already have one argument
if ($#ARGV != 1)
{
print STDERR "Invalid number of arguments (", $#ARGV+2, ")\n";
print_usage();
}
$main::srcdir = $ARGV[0];
$main::source = $_;
push @main::macrodirs,"$main::procdir/m4";
}

View file

@ -0,0 +1,10 @@
include $(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment
EXTRA_DIST = Makefile_list_of_sources.am_fragment $(files_tools_m4)
# Install the .m4, files:
tools_m4_includedir = $(libdir)/glibmm-2.4/proc/m4
tools_m4_include_HEADERS = $(files_tools_m4)

View file

@ -0,0 +1,439 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(tools_m4_include_HEADERS) \
$(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment
subdir = tools/m4
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/scripts/c_std.m4 \
$(top_srcdir)/scripts/cxx.m4 $(top_srcdir)/scripts/cxx_std.m4 \
$(top_srcdir)/scripts/docgen.m4 \
$(top_srcdir)/scripts/glibmm_check_perl.m4 \
$(top_srcdir)/scripts/macros.m4 \
$(top_srcdir)/scripts/reduced.m4 $(top_srcdir)/scripts/sun.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/glib/glibmmconfig.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(tools_m4_includedir)"
tools_m4_includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(tools_m4_include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISABLE_DEPRECATED_API_CFLAGS = @DISABLE_DEPRECATED_API_CFLAGS@
DISABLE_DEPRECATED_CFLAGS = @DISABLE_DEPRECATED_CFLAGS@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GLIBMM_CFLAGS = @GLIBMM_CFLAGS@
GLIBMM_LIBS = @GLIBMM_LIBS@
GLIBMM_MAJOR_VERSION = @GLIBMM_MAJOR_VERSION@
GLIBMM_MICRO_VERSION = @GLIBMM_MICRO_VERSION@
GLIBMM_MINOR_VERSION = @GLIBMM_MINOR_VERSION@
GLIBMM_RELEASE = @GLIBMM_RELEASE@
GLIBMM_VERSION = @GLIBMM_VERSION@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTKMMPROC_MERGECDOCS = @GTKMMPROC_MERGECDOCS@
GTKMM_DOXYGEN_INPUT = @GTKMM_DOXYGEN_INPUT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBGLIBMM_SO_VERSION = @LIBGLIBMM_SO_VERSION@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL_PATH = @PERL_PATH@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
files_tools_m4 = base.m4 class_shared.m4 class_boxedtype.m4 class_boxedtype_static.m4 \
class_generic.m4 class_gobject.m4 class_gtkobject.m4 \
class_interface.m4 class_opaque_refcounted.m4 class_opaque_copyable.m4 \
gerror.m4 \
compare.m4 convert.m4 convert_base.m4 convert_gtkmm.m4 convert_atk.m4 convert_gdk.m4 \
convert_glib.m4 convert_gtk.m4 convert_pango.m4 ctor.m4 doc.m4 enum.m4 list.m4 member.m4 \
method.m4 property.m4 signal.m4 vfunc.m4
EXTRA_DIST = Makefile_list_of_sources.am_fragment $(files_tools_m4)
# Install the .m4, files:
tools_m4_includedir = $(libdir)/glibmm-2.4/proc/m4
tools_m4_include_HEADERS = $(files_tools_m4)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/tools/m4/Makefile_list_of_sources.am_fragment $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/m4/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tools/m4/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-tools_m4_includeHEADERS: $(tools_m4_include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(tools_m4_includedir)" || $(MKDIR_P) "$(DESTDIR)$(tools_m4_includedir)"
@list='$(tools_m4_include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(tools_m4_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(tools_m4_includedir)/$$f'"; \
$(tools_m4_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(tools_m4_includedir)/$$f"; \
done
uninstall-tools_m4_includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(tools_m4_include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(tools_m4_includedir)/$$f'"; \
rm -f "$(DESTDIR)$(tools_m4_includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(tools_m4_includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-tools_m4_includeHEADERS
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-tools_m4_includeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip \
install-tools_m4_includeHEADERS installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags uninstall uninstall-am \
uninstall-tools_m4_includeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,8 @@
files_tools_m4 = base.m4 class_shared.m4 class_boxedtype.m4 class_boxedtype_static.m4 \
class_generic.m4 class_gobject.m4 class_gtkobject.m4 \
class_interface.m4 class_opaque_refcounted.m4 class_opaque_copyable.m4 \
gerror.m4 \
compare.m4 convert.m4 convert_base.m4 convert_gtkmm.m4 convert_atk.m4 convert_gdk.m4 \
convert_glib.m4 convert_gtk.m4 convert_pango.m4 ctor.m4 doc.m4 enum.m4 list.m4 member.m4 \
method.m4 property.m4 signal.m4 vfunc.m4

View file

@ -0,0 +1,436 @@
dnl $Id: base.m4 454 2007-10-12 19:58:00Z arminb $
divert(-1)
dnl
dnl The general convention is
dnl _* are macros
dnl __*__ are variables
dnl
dnl rename several m4 builtins to avoid name clashes
dnl
define(`_PREFIX_BUILTIN_ALIAS', `define(`m4_$1', defn(`$1'))')
define(`_PREFIX_BUILTIN', `_PREFIX_BUILTIN_ALIAS(`$1')`'undefine(`$1')')
_PREFIX_BUILTIN(`builtin')
_PREFIX_BUILTIN(`decr')
_PREFIX_BUILTIN(`errprint')
_PREFIX_BUILTIN(`esyscmd')
_PREFIX_BUILTIN(`eval')
_PREFIX_BUILTIN(`format')
_PREFIX_BUILTIN(`incr')
_PREFIX_BUILTIN(`index')
_PREFIX_BUILTIN(`indir')
_PREFIX_BUILTIN(`len')
_PREFIX_BUILTIN(`maketemp')
_PREFIX_BUILTIN(`syscmd')
_PREFIX_BUILTIN(`substr')
_PREFIX_BUILTIN(`sysval')
_PREFIX_BUILTIN(`mkstemp')
dnl
dnl More alternative names for m4 macros, not undefined (yet!).
dnl
_PREFIX_BUILTIN_ALIAS(`changecom')
_PREFIX_BUILTIN_ALIAS(`changequote')
_PREFIX_BUILTIN_ALIAS(`define')
_PREFIX_BUILTIN_ALIAS(`divert')
_PREFIX_BUILTIN_ALIAS(`divnum')
_PREFIX_BUILTIN_ALIAS(`ifdef')
_PREFIX_BUILTIN_ALIAS(`ifelse')
_PREFIX_BUILTIN_ALIAS(`include')
_PREFIX_BUILTIN_ALIAS(`m4exit')
_PREFIX_BUILTIN_ALIAS(`m4wrap')
_PREFIX_BUILTIN_ALIAS(`patsubst')
_PREFIX_BUILTIN_ALIAS(`popdef')
_PREFIX_BUILTIN_ALIAS(`pushdef')
_PREFIX_BUILTIN_ALIAS(`shift')
_PREFIX_BUILTIN_ALIAS(`undefine')
_PREFIX_BUILTIN_ALIAS(`undivert')
_PREFIX_BUILTIN_ALIAS(`regexp')
_PREFIX_BUILTIN_ALIAS(`translit')
dnl
dnl Type Conversion Macros
dnl
m4_include(convert.m4)
dnl
dnl ----------------------- Utility Macros -------------------------
dnl
dnl
dnl Add a comma before the arg if any, do nothing otherwise
dnl _COMMA_PREFIX(a) -> ,a
dnl _COMMA_PREFIX() -> `'
dnl
define(`_COMMA_PREFIX', `m4_ifelse(m4_eval(m4_len(`$*') >= 1), 1, `,$*')')dnl
dnl
dnl Add a comma after the arg if any, do nothing otherwise
dnl _COMMA_SUFFIX(a) -> a,
dnl _COMMA_SUFFIX() -> `'
dnl
define(`_COMMA_SUFFIX', `m4_ifelse(m4_eval(m4_len(`$*') >= 1), 1, `$*,')')dnl
dnl
dnl _UPPER(string)
dnl uppercase a string
define(`_UPPER',`m4_translit(`$*',`abcdefghijklmnopqrstuvwxyz',`ABCDEFGHIJKLMNOPQRSTUVWXYZ')')
dnl
dnl _LOWER(string)
dnl lower a string
define(`_LOWER',`m4_translit(`$*',`ABCDEFGHIJKLMNOPQRSTUVWXYZ',`abcdefghijklmnopqrstuvwxyz')')
dnl
dnl _QUOTE(macro)
dnl If a macro generates an output with commas we need to protect it
dnl from being broken down and interpreted
define(`_QUOTE',``$*'')
dnl
dnl _NUM(arglist)
dnl count number of arguments
define(`_NUM',`m4_ifelse(m4_len(`$*'),0,0,`$#')')
dnl
dnl For handling of included macro files.
dnl
dnl _PUSH(section_name)
dnl Uses pushdef() to redefine the __DIV__ macro
dnl so that it diverts ouput to the section_name,
dnl or discards it (-1) if no section_name is given.
dnl TODO: However, as far as I can tell, __DIV__ is not used anywhere. murrayc.
define(`_PUSH',`pushdef(`__DIV__',divnum)m4_divert(m4_ifelse($1,,-1,__SEC_$1))dnl`'')
dnl _POP(section_name)
dnl Uses popdef() to go back to the previous definition of the __DIV__ macro.
define(`_POP',`m4_divert(__DIV__)popdef(`__DIV__')dnl`'')
dnl _SECTION(section_name):
dnl m4_divert() sends subsequent output to the specified file:
define(`_SECTION',`m4_divert(__SEC_$1)dnl')
dnl _IMPORT(section_name):
define(`_IMPORT',`m4_undivert(__SEC_$1)dnl')
dnl _GET_TYPE_FUNC(GtkWidget) -> gtk_widget_get_type()
dnl The funny `[A-Z]?' part of the regexp is to catch things like GdkGCFooBar.
define(`_GET_TYPE_FUNC',`dnl
m4_translit(m4_substr(m4_patsubst(`$1',`[A-Z]?[A-Z]',`_\&'),1),`[A-Z]',`[a-z]')_get_type()`'dnl
')
dnl Define a new diversion
dnl In m4, m4_divert() selects the output file to be used for subsequent text output.
dnl 0 is the normal output. We define extra output files with _NEW_SECTION().
dnl This macro seems to redefine __SEC_COUNT as __SEC_COUNT+1, and also
dnl define __SEC_<the macro argument> as __SEC_COUNT.
dnl So it just sets that section identifier to the next number.
define(`__SEC_COUNT__',0)
define(`_NEW_SECTION',`dnl
define(`__SEC_COUNT__',m4_eval(__SEC_COUNT__+1))dnl
define(`__SEC_$1',__SEC_COUNT__)dnl
')
changequote([,])
define([__BT__],[changequote(,)`changequote(`,')])
define([__FT__],[changequote(,)'changequote(`,')])
changequote(`,')
changecom()
dnl
dnl ----------------------- Main Headers -------------------------
dnl
_NEW_SECTION(SECTION_HEADER_FIRST)dnl Before any generated code
_NEW_SECTION(SECTION_HEADER1) dnl header up to the first namespace
_NEW_SECTION(SECTION_HEADER2) dnl header after the first namespace
_NEW_SECTION(SECTION_HEADER3) dnl header after the first namespace
_NEW_SECTION(SECTION_PHEADER) dnl private header
_NEW_SECTION(SECTION_CC_INCLUDES) dnl section for additional includes
_NEW_SECTION(SECTION_SRC_CUSTOM) dnl user supplied implementation
_NEW_SECTION(SECTION_ANONYMOUS_NAMESPACE) dnl built implementation in anonymous namespace
_NEW_SECTION(SECTION_SRC_GENERATED) dnl built implementation
_NEW_SECTION(SECTION_CLASS1) dnl decl to _CLASS
_NEW_SECTION(SECTION_CLASS2) dnl _CLASS to end of class
_NEW_SECTION(SECTION_CC) dnl section for methods (in current namespace)
_NEW_SECTION(SECTION_CC_IMPLEMENTS_INTERFACES) dnl Calls SomeBaseInterface::add_interface(get_type()).
dnl Virtual Functions and Default Signal Handlers (Very similar)
_NEW_SECTION(SECTION_H_VFUNCS) dnl Declaration of vfunc hooks.
_NEW_SECTION(SECTION_H_VFUNCS_CPPWRAPPER) dnl Convenience method, using C++ types, that just calls the vfunc.
_NEW_SECTION(SECTION_H_DEFAULT_SIGNAL_HANDLERS) dnl Declaration of default signal handler' hooks.
_NEW_SECTION(SECTION_CC_DEFAULT_SIGNAL_HANDLERS)
_NEW_SECTION(SECTION_CC_VFUNCS)
_NEW_SECTION(SECTION_CC_VFUNCS_CPPWRAPPER) dnl Convenience method, using C++ types, that just calls the vfunc.
_NEW_SECTION(SECTION_PH_DEFAULT_SIGNAL_HANDLERS) dnl private class declaration
_NEW_SECTION(SECTION_PH_VFUNCS) dnl private class declaration
_NEW_SECTION(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS) dnl private class implementation
_NEW_SECTION(SECTION_PCC_VFUNCS) dnl private class implementation
_NEW_SECTION(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS) dnl gtk+ class_init function
_NEW_SECTION(SECTION_PCC_CLASS_INIT_VFUNCS) dnl gtk+ class_init function
dnl Signal Proxies:
dnl _NEW_SECTION(SECTION_H_SIGNALPROXIES) dnl signal member objects
_NEW_SECTION(SECTION_CC_SIGNALPROXIES) dnl signal member objects
dnl Property Proxies:
dnl _NEW_SECTION(SECTION_H_PROPERTYPROXIES)
_NEW_SECTION(SECTION_CC_PROPERTYPROXIES)
_NEW_SECTION(SECTION_CC_INITIALIZE_CLASS_EXTRA) dnl For instance, to initialize special member data from all constructors. Not commonly used.
dnl _NEW_SECTION(PROXY)
dnl _NEW_SECTION(SECTION_PCC_OBJECT_INIT) dnl gtk+ object_init function
_NEW_SECTION(SECTION_CHECK)
_NEW_SECTION(SECTION_USR)
define(`_CHECK',`dnl
_PUSH(SECTION_CHECK)
$*
_POP()
')
dnl This macro is for including the config header before any code (such as
dnl the #ifndef *_DISABLE_DEPRECATED in deprecated classes) is generated.
define(`_CONFIGINCLUDE',`dnl
_PUSH(SECTION_HEADER_FIRST)
#include <$1>
_POP()
')
dnl Start of processing
dnl
dnl _START(filname, module,modulecanonical) .e.g _START(button, gtkmm, gtkmm)
define(`_START',`dnl
define(`__MODULE__',$2)dnl
define(`__MODULE_CANONICAL__',$3)dnl
define(`__HEADER_GUARD__',`_`'_UPPER(m4_translit(`$3`'_`'$1', `-', `_'))')dnl
define(`__FILE__',$1)dnl
define(`__DEPRECATION_GUARD__',`_UPPER($3)'`_DISABLE_DEPRECATED')dnl
_SECTION(SECTION_HEADER1)
')
dnl Start deprecation of individual methods:
define(`_DEPRECATE_IFDEF_START',`dnl
#ifndef __DEPRECATION_GUARD__'
)
dnl end deprecation of individual methods:
define(`_DEPRECATE_IFDEF_END',`dnl
#endif // __DEPRECATION_GUARD__'
)
dnl begin optional deprecation of whole class
define(`_DEPRECATE_IFDEF_CLASS_START',`dnl
ifdef(`__BOOL_DEPRECATED__',`dnl
_DEPRECATE_IFDEF_START',`dnl
')
')
dnl end optional deprecation of whole class
define(`_DEPRECATE_IFDEF_CLASS_END',`dnl
ifdef(`__BOOL_DEPRECATED__',`dnl
_DEPRECATE_IFDEF_END',`dnl
')
')
dnl This does all the work of assembling the final output
dnl
dnl _END()
dnl
define(`_END',`dnl
m4_divert(0)dnl
#S 0 dnl Marks the beginning of the header file.
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef __HEADER_GUARD__`'_H
#define __HEADER_GUARD__`'_H
_IMPORT(SECTION_HEADER_FIRST)
_DEPRECATE_IFDEF_CLASS_START
m4_ifelse(__MODULE__,glibmm,,`dnl else
#include <glibmm.h>
')dnl
_IMPORT(SECTION_HEADER1)
_IMPORT(SECTION_HEADER2)
_IMPORT(SECTION_HEADER3)
_DEPRECATE_IFDEF_CLASS_END
#endif /* __HEADER_GUARD__`'_H */
#S 1 dnl Marks the beginning of the private header file.
// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef __HEADER_GUARD__`'_P_H
#define __HEADER_GUARD__`'_P_H
_DEPRECATE_IFDEF_CLASS_START
_IMPORT(SECTION_PHEADER)
_DEPRECATE_IFDEF_CLASS_END
#endif /* __HEADER_GUARD__`'_P_H */
#S 2 dnl Marks the beginning of the source file.
// Generated by gtkmmproc -- DO NOT MODIFY!
_DEPRECATE_IFDEF_CLASS_START
#include <__MODULE__/__FILE__.h>
#include <__MODULE__/private/__FILE__`'_p.h>
_IMPORT(SECTION_CC_INCLUDES)
_IMPORT(SECTION_SRC_CUSTOM)
namespace
{
_IMPORT(SECTION_ANONYMOUS_NAMESPACE)
} // anonymous namespace
_IMPORT(SECTION_SRC_GENERATED)
_DEPRECATE_IFDEF_CLASS_END
m4_divert(-1)
m4_undivert()
')
define(`_NAMESPACE',`dnl
_PUSH()
m4_ifdef(`__NAMESPACE__',`dnl
pushdef(`__NAMESPACE__',__NAMESPACE__`::'$1)
pushdef(`__NAMESPACE_BEGIN__',__NAMESPACE_BEGIN__`
namespace '$1`
{')
pushdef(`__NAMESPACE_END__',`} // namespace '$1`
'__NAMESPACE_END__)
',`dnl else
pushdef(`__NAMESPACE__',$1)
pushdef(`__NAMESPACE_BEGIN__',`namespace '$1`
{')
pushdef(`__NAMESPACE_END__',`} // namespace '$1)
')dnl endif __NAMESPACE__
_POP()
')dnl enddef _NAMESPACE
define(`_END_NAMESPACE',`dnl
_PUSH()
popdef(`__NAMESPACE__')
popdef(`__NAMESPACE_BEGIN__')
popdef(`__NAMESPACE_END__')
_POP()
')dnl enddef _END_NAMESPACE
define(`_INCLUDE_FLAG',`__FLAG_$1_INCLUDE_`'_UPPER(m4_translit(`$2',`/.-',`___'))__')dnl
define(`_PH_INCLUDE',`dnl
m4_ifdef(_INCLUDE_FLAG(PH,`$*'),,`dnl else
define(_INCLUDE_FLAG(PH,`$*'))dnl
_PUSH(SECTION_PHEADER)
#include <$*>
_POP()
')dnl endif
')dnl
define(`_CC_INCLUDE',`dnl
m4_ifdef(_INCLUDE_FLAG(CC,`$*'),,`dnl else
define(_INCLUDE_FLAG(CC,`$*'))dnl
_PUSH(SECTION_CC_INCLUDES)
#include <$*>
_POP()
')dnl endif
')dnl
define(`_PINCLUDE', defn(`_PH_INCLUDE'))
# Put these, for instance, around gtkmmproc macros (_WRAP_SIGNAL)
# to make the #ifndef appear around the generated code in both the .h
# and .cc files.
# e.g. _GTKMMPROC_H_AND_CC(#ifndef _SUN_CC_)
# e.g. _GTKMMPROC_H_AND_CC(#endif //_SUN_CC_)
# _GTKMMPROC_H_AND_CC(code)
define(`_GTKMMPROC_H_AND_CC',`dnl
$1
_PUSH(SECTION_CC)
$1
_POP()
')dnl
# Same thing as _GTKMMPROC_H_AND_CC but for signals (_WRAP_SIGNAL)
define(`_GTKMMPROC_SIGNAL_H_AND_CC',`dnl
$1
_PUSH(SECTION_ANONYMOUS_NAMESPACE)
$1
_POP()
$1
_PUSH(SECTION_H_DEFAULT_SIGNAL_HANDLERS)
$1
_POP()
$1
_PUSH(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS)
$1
_POP()
$1
_PUSH(SECTION_CC_DEFAULT_SIGNAL_HANDLERS)
$1
_POP()
$1
_PUSH(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS)
$1
_POP()
$1
_PUSH(SECTION_CC_SIGNALPROXIES)
$1
_POP()
')dnl
m4_include(class_shared.m4)
m4_include(class_generic.m4)
m4_include(class_gobject.m4)
m4_include(class_gtkobject.m4)
m4_include(class_boxedtype.m4)
m4_include(class_boxedtype_static.m4)
m4_include(class_interface.m4)
m4_include(class_opaque_copyable.m4)
m4_include(class_opaque_refcounted.m4)
m4_include(gerror.m4)
m4_include(signal.m4)
m4_include(vfunc.m4)
m4_include(method.m4)
m4_include(member.m4)
m4_include(compare.m4)
m4_include(ctor.m4)
m4_include(property.m4)
m4_include(enum.m4)
_SECTION(SECTION_HEADER1)

View file

@ -0,0 +1,218 @@
dnl $Id: class_boxedtype.m4 413 2007-05-14 19:28:31Z murrayc $
dnl
dnl _CLASS_BOXEDTYPE(Region, GdkRegion, gdk_region_new, gdk_region_copy, gdk_region_destroy)
dnl
define(`_CLASS_BOXEDTYPE',`dnl
_PUSH()
dnl
dnl Define the args for later macros
define(`__CPPNAME__',`$1')
define(`__CNAME__',`$2')
define(`__BOXEDTYPE_FUNC_NEW',`$3')
define(`__BOXEDTYPE_FUNC_COPY',`$4')
define(`__BOXEDTYPE_FUNC_FREE',`$5')
define(`_CUSTOM_DEFAULT_CTOR',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_DEFAULT_CTOR__',`$1')
_POP()
')
_POP()
_SECTION(SECTION_CLASS2)
') dnl End of _CLASS_BOXEDTYPE.
dnl Some of the Gdk types are unions - e.g. GdkEvent.
define(`_CUSTOM_STRUCT_PROTOTYPE',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_STRUCT_PROTOTYPE__',`$1')
_POP()
')
dnl
dnl _END_CLASS_BOXEDTYPE()
dnl denotes the end of a class
dnl
define(`_END_CLASS_BOXEDTYPE',`
_SECTION(SECTION_HEADER1)
ifdef(`__BOOL_CUSTOM_STRUCT_PROTOTYPE__',`dnl
',`dnl
#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _`'__CNAME__ __CNAME__; }
#endif
')dnl
_SECTION(SECTION_HEADER3)
__NAMESPACE_BEGIN__
/** @relates __NAMESPACE__::__CPPNAME__
* @param lhs The left-hand side
* @param rhs The right-hand side
*/
inline void swap(__CPPNAME__& lhs, __CPPNAME__& rhs)
{ lhs.swap(rhs); }
__NAMESPACE_END__
namespace Glib
{
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates __NAMESPACE__::__CPPNAME__
*/
__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy = false);
')dnl endif __BOOL_NO_WRAP_FUNCTION__
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <>
class Value<__NAMESPACE__::__CPPNAME__> : public Glib::Value_Boxed<__NAMESPACE__::__CPPNAME__>
{};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
} // namespace Glib
_SECTION(SECTION_SRC_GENERATED)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
namespace Glib
{
__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy)
{
return __NAMESPACE__::__CPPNAME__`'(object, take_copy);
}
} // namespace Glib
')dnl endif
__NAMESPACE_BEGIN__
dnl
dnl The implementation:
dnl
// static
GType __CPPNAME__::get_type()
{
return _GET_TYPE_FUNC(__CNAME__);
}
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
',`dnl else
__CPPNAME__::__CPPNAME__`'()
:
ifelse(__BOXEDTYPE_FUNC_NEW,NONE,`dnl
gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
',`dnl else
gobject_ (__BOXEDTYPE_FUNC_NEW`'())
')dnl
{}
')dnl endif __BOOL_CUSTOM_DEFAULT_CTOR__
__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& other)
:
gobject_ ((other.gobject_) ? __BOXEDTYPE_FUNC_COPY`'(other.gobject_) : 0)
{}
__CPPNAME__::__CPPNAME__`'(__CNAME__* gobject, bool make_a_copy)
:
// For BoxedType wrappers, make_a_copy is true by default. The static
// BoxedType wrappers must always take a copy, thus make_a_copy = true
// ensures identical behaviour if the default argument is used.
gobject_ ((make_a_copy && gobject) ? __BOXEDTYPE_FUNC_COPY`'(gobject) : gobject)
{}
__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& other)
{
__CPPNAME__ temp (other);
swap(temp);
return *this;
}
__CPPNAME__::~__CPPNAME__`'()
{
dnl This could be a free or an unref, we do not need to know.
if(gobject_)
__BOXEDTYPE_FUNC_FREE`'(gobject_);
}
void __CPPNAME__::swap(__CPPNAME__& other)
{
__CNAME__ *const temp = gobject_;
gobject_ = other.gobject_;
other.gobject_ = temp;
}
__CNAME__* __CPPNAME__::gobj_copy() const
{
return __BOXEDTYPE_FUNC_COPY`'(gobject_);
}
_IMPORT(SECTION_CC)
__NAMESPACE_END__
dnl
dnl
dnl
dnl
_POP()
dnl
dnl
dnl The actual class, e.g. Pango::FontDescription, declaration:
dnl
_IMPORT(SECTION_CLASS1)
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __CNAME__ BaseObjectType;
static GType get_type() G_GNUC_CONST;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
',`dnl else
__CPPNAME__`'();
')dnl
explicit __CPPNAME__`'(__CNAME__* gobject, bool make_a_copy = true);
__CPPNAME__`'(const __CPPNAME__& other);
__CPPNAME__& operator=(const __CPPNAME__& other);
~__CPPNAME__`'();
void swap(__CPPNAME__& other);
///Provides access to the underlying C instance.
__CNAME__* gobj() { return gobject_; }
///Provides access to the underlying C instance.
const __CNAME__* gobj() const { return gobject_; }
///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
__CNAME__* gobj_copy() const;
protected:
__CNAME__* gobject_;
private:
_IMPORT(SECTION_CLASS2)
')

View file

@ -0,0 +1,169 @@
dnl $Id: class_boxedtype_static.m4 58 2003-12-14 11:53:04Z murrayc $
dnl
dnl _CLASS_BOXEDTYPE_STATIC(TreeIter, GtkTreeIter)
dnl
define(`_CLASS_BOXEDTYPE_STATIC',`dnl
_PUSH()
dnl
dnl Define the args for later macros
define(`__CPPNAME__',`$1')
define(`__CNAME__',`$2')
define(`_CUSTOM_DEFAULT_CTOR',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_DEFAULT_CTOR__',`$1')
_POP()
')
define(`_CUSTOM_CTOR_CAST',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
_POP()
')
_POP()
_SECTION(SECTION_CLASS2)
') dnl End of _CLASS_BOXEDTYPE_STATIC.
dnl TreeIterBase shouldn't have a wrap() method - we'll custom implement them for TreeIter and TreeRow:
define(`_NO_WRAP_FUNCTION',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_NO_WRAP_FUNCTION__',`$1')
_POP()
')
dnl
dnl _END_CLASS_BOXEDTYPE_STATIC()
dnl denotes the end of a class
dnl
define(`_END_CLASS_BOXEDTYPE_STATIC',`
_SECTION(SECTION_HEADER3)
namespace Glib
{
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
/** @relates __NAMESPACE__::__CPPNAME__
* @param object The C instance
* @result A C++ instance that wraps this C instance.
*/
__NAMESPACE__::__CPPNAME__& wrap(__CNAME__* object);
/** @relates __NAMESPACE__::__CPPNAME__
* @param object The C instance
* @result A C++ instance that wraps this C instance.
*/
const __NAMESPACE__::__CPPNAME__& wrap(const __CNAME__* object);
')dnl endif __BOOL_NO_WRAP_FUNCTION__
#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <>
class Value<__NAMESPACE__::__CPPNAME__> : public Glib::Value_Boxed<__NAMESPACE__::__CPPNAME__>
{};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
} // namespace Glib
_SECTION(SECTION_SRC_GENERATED)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
namespace Glib
{
__NAMESPACE__::__CPPNAME__& wrap(__CNAME__* object)
{
return *reinterpret_cast<__NAMESPACE__::__CPPNAME__*>(object);
}
const __NAMESPACE__::__CPPNAME__& wrap(const __CNAME__* object)
{
return *reinterpret_cast<const __NAMESPACE__::__CPPNAME__*>(object);
}
} // namespace Glib
')dnl endif __BOOL_NO_WRAP_FUNCTION__
__NAMESPACE_BEGIN__
dnl
dnl The implementation:
dnl
dnl // static
dnl const __CNAME__ __CPPNAME__::gobject_initializer_ = { 0, };
dnl
// static
GType __CPPNAME__::get_type()
{
return _GET_TYPE_FUNC(__CNAME__);
}
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',,`dnl else
__CPPNAME__::__CPPNAME__`'()
{
GLIBMM_INITIALIZE_STRUCT`'(gobject_, __CNAME__);
}
')dnl
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
__CPPNAME__::__CPPNAME__`'(const __CNAME__* gobject)
{
if(gobject)
gobject_ = *gobject;
else
GLIBMM_INITIALIZE_STRUCT`'(gobject_, __CNAME__);
}
')dnl
_IMPORT(SECTION_CC)
__NAMESPACE_END__
dnl
dnl
dnl
dnl
_POP()
dnl
dnl
dnl The actual class, e.g. Gtk::TreeIter, declaration:
dnl
_IMPORT(SECTION_CLASS1)
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __CNAME__ BaseObjectType;
static GType get_type() G_GNUC_CONST;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',,`dnl else
__CPPNAME__`'();
')dnl
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',,`dnl else
explicit __CPPNAME__`'(const __CNAME__* gobject); // always takes a copy
')dnl
///Provides access to the underlying C instance.
__CNAME__* gobj() { return &gobject_; }
///Provides access to the underlying C instance.
const __CNAME__* gobj() const { return &gobject_; }
protected:
__CNAME__ gobject_;
dnl static const __CNAME__ gobject_initializer_;
private:
_IMPORT(SECTION_CLASS2)
')

View file

@ -0,0 +1,54 @@
dnl $Id: class_generic.m4 2 2003-01-07 16:59:16Z murrayc $
dnl
dnl _CLASS_GENERIC(LayoutIter, PangoLayoutIter)
dnl
define(`_CLASS_GENERIC',`dnl
_PUSH()
dnl
dnl Define the args for later macros
define(`__CPPNAME__',`$1')
define(`__CNAME__',`$2')
_POP()
_SECTION(SECTION_CLASS2)
') dnl End of _CLASS_GENERIC.
dnl
dnl _END_CLASS_GENERIC()
dnl denotes the end of a class
dnl
define(`_END_CLASS_GENERIC',`
_SECTION(SECTION_SRC_GENERATED)
__NAMESPACE_BEGIN__
dnl The implementation:
_IMPORT(SECTION_CC)
__NAMESPACE_END__
dnl
dnl
dnl
dnl
_POP()
dnl
dnl
dnl The actual class, e.g. Pango::FontDescription, declaration:
dnl
_IMPORT(SECTION_CLASS1)
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __CNAME__ BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
private:
_IMPORT(SECTION_CLASS2)
')

View file

@ -0,0 +1,243 @@
dnl $Id: class_gobject.m4 413 2007-05-14 19:28:31Z murrayc $
define(`_CLASS_GOBJECT',`dnl
_PUSH()
dnl
dnl Define the args for later macros
define(`__CPPNAME__',`$1')
define(`__CNAME__',`$2')
define(`__CCAST__',`$3')
define(`__BASE__',_LOWER(__CPPNAME__))
define(`__CPPPARENT__',`$4')
define(`__CPARENT__',`$5')
define(`__PCAST__',`($5*)')
dnl Some C types, e.g. GdkWindow or GdkPixmap, are a typedef to their base type,
dnl rather than the real instance type. That is really ugly, yes. We get around
dnl the problem by supporting optional __REAL_* arguments to this macro.
define(`__REAL_CNAME__',ifelse(`$6',,__CNAME__,`$6'))
define(`__REAL_CPARENT__',ifelse(`$7',,__CPARENT__,`$7'))
_POP()
_SECTION(SECTION_CLASS2)
') dnl end of _CLASS_GOBJECT
dnl Widget and Object, and some others, have custom-written destructor implementations:
define(`_CUSTOM_DTOR',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_DTOR__',`$1')
_POP()
')
dnl Gdk::Pixmap_Class::wrap_new() needs a custom implementation, in order
dnl to create a Gdk::Bitmap object if appropriate. See comments there.
define(`_CUSTOM_WRAP_NEW',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_WRAP_NEW__',`1')
_POP()
')
dnl Gnome::Canvas::CanvasAA::CanvasAA() needs access to the
dnl normally-private canvas_class_ member variable. See comments there.
define(`_GMMPROC_PROTECTED_GCLASS',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_PROTECTED_GCLASS__',`1')
_POP()
')
dnl Some of the Gdk types are actually direct typedefs of their base type.
dnl This means that 2 wrap functions would have the same argument.
dnl define(`_NO_WRAP_FUNCTION',`dnl
dnl _PUSH()
dnl Define this macro to be tested for later.
dnl define(`__BOOL_NO_WRAP_FUNCTION__',`$1')
dnl _POP()
dnl ')
dnl
dnl _CREATE_METHOD(args_type_and_name_hpp, args_type_and_name_cpp,args_name_only);
dnl
define(`_CREATE_METHOD',`
static Glib::RefPtr<`'__CPPNAME__`'> create(`'$1`');
_PUSH(SECTION_CC)
Glib::RefPtr<`'__CPPNAME__`'> __CPPNAME__`'::create(`'$2`')
{
return Glib::RefPtr<`'__CPPNAME__`'>( new __CPPNAME__`'(`'$3`') );
}
_POP()
')
dnl
dnl _END_CLASS_GOBJECT()
dnl denotes the end of a class
dnl
define(`_END_CLASS_GOBJECT',`
_SECTION(SECTION_HEADER1)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl
_STRUCT_PROTOTYPE()
')dnl
__NAMESPACE_BEGIN__ class __CPPNAME__`'_Class; __NAMESPACE_END__
_SECTION(SECTION_HEADER3)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates __NAMESPACE__::__CPPNAME__
*/
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__REAL_CNAME__`'* object, bool take_copy = false);
}
')dnl
dnl
dnl
_SECTION(SECTION_PHEADER)
#include <glibmm/class.h>
__NAMESPACE_BEGIN__
_PH_CLASS_DECLARATION()
__NAMESPACE_END__
_SECTION(SECTION_SRC_GENERATED)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
namespace Glib
{
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__REAL_CNAME__`'* object, bool take_copy)
{
return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
//We use dynamic_cast<> in case of multiple inheritance.
}
} /* namespace Glib */
')dnl endif
__NAMESPACE_BEGIN__
/* The *_Class implementation: */
_PCC_CLASS_IMPLEMENTATION()
m4_ifdef(`__BOOL_CUSTOM_WRAP_NEW__',,`dnl else
Glib::ObjectBase* __CPPNAME__`'_Class::wrap_new(GObject* object)
{
return new __CPPNAME__`'((__CNAME__*)`'object);
}
')dnl endif
/* The implementation: */
__CNAME__* __CPPNAME__::gobj_copy()
{
reference();
return gobj();
}
__CPPNAME__::__CPPNAME__`'(const Glib::ConstructParams& construct_params)
:
__CPPPARENT__`'(construct_params)
{}
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
:
__CPPPARENT__`'(__PCAST__`'(castitem))
{}
ifdef(`__BOOL_CUSTOM_DTOR__',`dnl
',`dnl
__CPPNAME__::~__CPPNAME__`'()
{}
')dnl
_CC_CLASS_IMPLEMENTATION()
__NAMESPACE_END__
dnl
dnl
dnl
dnl
_POP()
dnl
dnl The actual class, e.g. Gtk::Widget, declaration:
dnl _IMPORT(SECTION_H_SIGNALPROXIES_CUSTOM)
_IMPORT(SECTION_CLASS1)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef __CPPNAME__ CppObjectType;
typedef __CPPNAME__`'_Class CppClassType;
typedef __CNAME__ BaseObjectType;
typedef __REAL_CNAME__`'Class BaseClassType;
m4_ifdef(`__BOOL_PROTECTED_GCLASS__',
`protected:',`dnl else
private:')dnl endif
friend class __CPPNAME__`'_Class;
static CppClassType `'__BASE__`'_class_;
private:
// noncopyable
__CPPNAME__`'(const __CPPNAME__&);
__CPPNAME__& operator=(const __CPPNAME__&);
protected:
explicit __CPPNAME__`'(const Glib::ConstructParams& construct_params);
explicit __CPPNAME__`'(__CNAME__* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
virtual ~__CPPNAME__`'();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_type() G_GNUC_CONST;
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
__CNAME__* gobj() { return reinterpret_cast<__CNAME__*>(gobject_); }
///Provides access to the underlying C GObject.
const __CNAME__* gobj() const { return reinterpret_cast<__CNAME__*>(gobject_); }
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
__CNAME__* gobj_copy();
private:
_IMPORT(SECTION_CLASS2)
public:
_H_VFUNCS_AND_SIGNALS()
')

View file

@ -0,0 +1,228 @@
dnl $Id: class_gtkobject.m4 413 2007-05-14 19:28:31Z murrayc $
define(`_CLASS_GTKOBJECT',`dnl
_PUSH()
dnl
dnl Define the args for later macros
define(`__CPPNAME__',`$1')
define(`__CNAME__',`$2')
define(`__CCAST__',`$3')
define(`__BASE__',_LOWER(__CPPNAME__))
define(`__CPPPARENT__',`$4')
define(`__CPARENT__',`$5')
define(`__PCAST__',`($5*)')
dnl Some C types, e.g. GdkWindow or GdkPixmap, are a typedef to their base type,
dnl rather than the real instance type. That is really ugly, yes. We get around
dnl the problem by supporting optional __REAL_* arguments to this macro.
define(`__REAL_CNAME__',ifelse(`$6',,__CNAME__,`$6'))
define(`__REAL_CPARENT__',ifelse(`$7',,__CPARENT__,`$7'))
dnl
dnl ----------------------- Constructors -------------------------
dnl
_POP()
_SECTION(SECTION_CLASS2)
')dnl end of _CLASS_GTKOBJECT
dnl Widget and Object, and some others, have custom-written destructor implementations:
define(`_CUSTOM_DTOR',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_DTOR__',`$1')
_POP()
')
dnl Gtk::Object has a custom-written cast implementation:
define(`_CUSTOM_CTOR_CAST',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_CTOR_CAST__',`$1')
_POP()
')
dnl Top-level windows can not be manage()ed, so we should not use manage() in wrap_new().
define(`_UNMANAGEABLE',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_UNMANAGEABLE__',`$1')
_POP()
')
dnl Optionally ifdef-out the whole .h and .cc files:
define(`_IS_DEPRECATED',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_DEPRECATED__',`$1')
_POP()
')
dnl Gnome::Canvas::CanvasAA::CanvasAA() needs access to the
dnl normally-private canvas_class_ member variable. See comments there.
define(`_GMMPROC_PROTECTED_GCLASS',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_PROTECTED_GCLASS__',`1')
_POP()
')
dnl
dnl _END_CLASS_GTKOBJECT()
dnl denotes the end of a class
dnl
define(`_END_CLASS_GTKOBJECT',`
_SECTION(SECTION_HEADER1)
_STRUCT_PROTOTYPE()
__NAMESPACE_BEGIN__ class __CPPNAME__`'_Class; __NAMESPACE_END__
_SECTION(SECTION_HEADER3)
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates __NAMESPACE__::__CPPNAME__
*/
__NAMESPACE__::__CPPNAME__`'* wrap(__CNAME__`'* object, bool take_copy = false);
} //namespace Glib
dnl
dnl
_SECTION(SECTION_PHEADER)
#include <glibmm/class.h>
__NAMESPACE_BEGIN__
_PH_CLASS_DECLARATION()
__NAMESPACE_END__
_SECTION(SECTION_SRC_GENERATED)
namespace Glib
{
__NAMESPACE__::__CPPNAME__`'* wrap(__CNAME__`'* object, bool take_copy)
{
return dynamic_cast<__NAMESPACE__::__CPPNAME__ *> (Glib::wrap_auto ((GObject*)(object), take_copy));
}
} /* namespace Glib */
__NAMESPACE_BEGIN__
/* The *_Class implementation: */
_PCC_CLASS_IMPLEMENTATION()
Glib::ObjectBase* __CPPNAME__`'_Class::wrap_new(GObject* o)
{
ifdef(`__BOOL_UNMANAGEABLE__',`dnl
return new __CPPNAME__`'((__CNAME__*)`'(o)); //top-level windows can not be manage()ed.
',`dnl
return manage(new __CPPNAME__`'((__CNAME__*)`'(o)));
')
}
/* The implementation: */
ifdef(`__BOOL_CUSTOM_CTOR_CAST__',`dnl necessary for Gtk::Object implementation
',`dnl
__CPPNAME__::__CPPNAME__`'(const Glib::ConstructParams& construct_params)
:
__CPPPARENT__`'(construct_params)
{
_IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA) dnl Does not seem to work - custom implement it instead.
}
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
:
__CPPPARENT__`'(__PCAST__`'(castitem))
{
_IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA) dnl Does not seem to work - custom implement it instead.
}
')dnl
ifdef(`__BOOL_CUSTOM_DTOR__',`dnl
',`dnl
__CPPNAME__::~__CPPNAME__`'()
{
destroy_();
}
')dnl
_CC_CLASS_IMPLEMENTATION()
__NAMESPACE_END__
dnl
dnl
dnl
dnl
_POP()
dnl The actual class, e.g. Gtk::Widget, declaration:
dnl _IMPORT(SECTION_H_SIGNALPROXIES_CUSTOM)
_IMPORT(SECTION_CLASS1)
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __CPPNAME__`'_Class CppClassType;
typedef __CNAME__ BaseObjectType;
typedef __REAL_CNAME__`'Class BaseClassType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
virtual ~__CPPNAME__`'();
#ifndef DOXYGEN_SHOULD_SKIP_THIS
m4_ifdef(`__BOOL_PROTECTED_GCLASS__',
`protected:',`dnl else
private:')dnl endif
friend class __CPPNAME__`'_Class;
static CppClassType `'__BASE__`'_class_;
// noncopyable
__CPPNAME__`'(const __CPPNAME__&);
__CPPNAME__& operator=(const __CPPNAME__&);
protected:
explicit __CPPNAME__`'(const Glib::ConstructParams& construct_params);
explicit __CPPNAME__`'(__CNAME__* castitem);
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_type() G_GNUC_CONST;
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GtkObject.
__CNAME__* gobj() { return reinterpret_cast<__CNAME__*>(gobject_); }
///Provides access to the underlying C GtkObject.
const __CNAME__* gobj() const { return reinterpret_cast<__CNAME__*>(gobject_); }
_H_VFUNCS_AND_SIGNALS()
private:
_IMPORT(SECTION_CLASS2)
')

View file

@ -0,0 +1,273 @@
dnl $Id: class_interface.m4 446 2007-09-26 15:10:44Z murrayc $
define(`_CLASS_INTERFACE',`dnl
_PUSH()
dnl
dnl Define the args for later macros
define(`__CPPNAME__',`$1')
define(`__CNAME__',`$2')
define(`__CCAST__',`$3')
define(`__CCLASS__',`$4') dnl SomethingIface or SomethingClass, both suffixes are used.
define(`__BASE__',_LOWER(__CPPNAME__))
define(`__CPPPARENT__',`Glib::Interface')
dnl define(`__CPARENT__',`GObject')
define(`__PCAST__',`(GObject*)')
define(`__BOOL_IS_INTERFACE__',`1')
_POP()
_SECTION(SECTION_CLASS2)
') dnl end of _CLASS_INTERFACE
dnl Some of the Gdk types are actually direct typedefs of their base type.
dnl This means that 2 wrap functions would have the same argument.
dnl define(`_NO_WRAP_FUNCTION',`dnl
dnl _PUSH()
dnl Define this macro to be tested for later.
dnl define(`__BOOL_NO_WRAP_FUNCTION__',`$1')
dnl _POP()
dnl ')
dnl
dnl
dnl
define(`_PH_CLASS_DECLARATION_INTERFACE',`dnl
class __CPPNAME__`'_Class : public Glib::Interface_Class
{
public:
typedef __CPPNAME__ CppObjectType;
typedef __CNAME__ BaseObjectType;
typedef __CCLASS__ BaseClassType;
typedef __CPPPARENT__`'_Class CppClassParent;
friend class __CPPNAME__;
const Glib::Interface_Class& init();
static void iface_init_function(void* g_iface, void* iface_data);
static Glib::ObjectBase* wrap_new(GObject*);
protected:
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
//Callbacks (default signal handlers):
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
//You could prevent the original default signal handlers being called by overriding the *_impl method.
_IMPORT(SECTION_PH_DEFAULT_SIGNAL_HANDLERS)
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
//Callbacks (virtual functions):
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_PH_VFUNCS)
#endif //GLIBMM_VFUNCS_ENABLED
};
')
dnl
dnl
dnl
define(`_PCC_CLASS_IMPLEMENTATION_INTERFACE',`dnl
const Glib::Interface_Class& __CPPNAME__`'_Class::init()
{
if(!gtype_) // create the GType if necessary
{
// Glib::Interface_Class has to know the interface init function
// in order to add interfaces to implementing types.
class_init_func_ = &__CPPNAME__`'_Class::iface_init_function;
// We can not derive from another interface, and it is not necessary anyway.
gtype_ = _LOWER(__CCAST__)_get_type();
}
return *this;
}
void __CPPNAME__`'_Class::iface_init_function(void* g_iface, void*)
{
BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
//This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
//This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
g_assert(klass != 0);
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS)
#endif //GLIBMM_VFUNCS_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
_IMPORT(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS)
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_PCC_VFUNCS)
#endif //GLIBMM_VFUNCS_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
_IMPORT(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS)
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
')
dnl
dnl _END_CLASS_INTERFACE()
dnl denotes the end of a class
dnl
define(`_END_CLASS_INTERFACE',`
_SECTION(SECTION_HEADER1)
_STRUCT_PROTOTYPE()
__NAMESPACE_BEGIN__ class __CPPNAME__`'_Class; __NAMESPACE_END__
_SECTION(SECTION_HEADER3)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates __NAMESPACE__::__CPPNAME__
*/
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__`'* object, bool take_copy = false);
} // namespace Glib
')dnl
dnl
dnl
_SECTION(SECTION_PHEADER)
#include <glibmm/private/interface_p.h>
__NAMESPACE_BEGIN__
_PH_CLASS_DECLARATION_INTERFACE()
__NAMESPACE_END__
_SECTION(SECTION_SRC_GENERATED)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
namespace Glib
{
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__`'* object, bool take_copy)
{
return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>( dynamic_cast<__NAMESPACE__::__CPPNAME__*> (Glib::wrap_auto_interface<__NAMESPACE__::__CPPNAME__> ((GObject*)(object), take_copy)) );
//We use dynamic_cast<> in case of multiple inheritance.
}
} // namespace Glib
')dnl endif
__NAMESPACE_BEGIN__
/* The *_Class implementation: */
_PCC_CLASS_IMPLEMENTATION_INTERFACE()
Glib::ObjectBase* __CPPNAME__`'_Class::wrap_new(GObject* object)
{
return new __CPPNAME__`'((__CNAME__*)`'(object));
}
/* The implementation: */
__CPPNAME__::__CPPNAME__`'()
:
Glib::Interface(__BASE__`'_class_.init())
{}
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem)
:
__CPPPARENT__`'(__PCAST__`'(castitem))
{}
__CPPNAME__::~__CPPNAME__`'()
{}
// static
void __CPPNAME__`'::add_interface(GType gtype_implementer)
{
__BASE__`'_class_.init().add_interface(gtype_implementer);
}
_CC_CLASS_IMPLEMENTATION()
__NAMESPACE_END__
dnl
dnl
dnl
dnl
_POP()
dnl
dnl The actual class, e.g. Gtk::Widget, declaration:
dnl _IMPORT(SECTION_H_SIGNALPROXIES_CUSTOM)
_IMPORT(SECTION_CLASS1)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
public:
typedef __CPPNAME__ CppObjectType;
typedef __CPPNAME__`'_Class CppClassType;
typedef __CNAME__ BaseObjectType;
typedef __CCLASS__ BaseClassType;
private:
friend class __CPPNAME__`'_Class;
static CppClassType `'__BASE__`'_class_;
// noncopyable
__CPPNAME__`'(const __CPPNAME__&);
__CPPNAME__& operator=(const __CPPNAME__&);
protected:
__CPPNAME__`'(); // you must derive from this class
public:
// This is public so that C++ wrapper instances can be
// created for C instances of unwrapped types.
// For instance, if an unexpected C type implements the C interface.
explicit __CPPNAME__`'(__CNAME__* castitem);
protected:
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
public:
virtual ~__CPPNAME__`'();
static void add_interface(GType gtype_implementer);
#ifndef DOXYGEN_SHOULD_SKIP_THIS
static GType get_type() G_GNUC_CONST;
static GType get_base_type() G_GNUC_CONST;
#endif
///Provides access to the underlying C GObject.
__CNAME__* gobj() { return reinterpret_cast<__CNAME__*>(gobject_); }
///Provides access to the underlying C GObject.
const __CNAME__* gobj() const { return reinterpret_cast<__CNAME__*>(gobject_); }
private:
_IMPORT(SECTION_CLASS2)
public:
_H_VFUNCS_AND_SIGNALS()
')

View file

@ -0,0 +1,184 @@
dnl $Id: class_opaque_copyable.m4 413 2007-05-14 19:28:31Z murrayc $
dnl
dnl _CLASS_OPAQUE_COPYABLE(Region, GdkRegion, gdk_region_new, gdk_region_copy, gdk_region_destroy)
dnl
define(`_CLASS_OPAQUE_COPYABLE',`dnl
_PUSH()
dnl
dnl Define the args for later macros
define(`__CPPNAME__',`$1')
define(`__CNAME__',`$2')
define(`__OPAQUE_FUNC_NEW',`$3')
define(`__OPAQUE_FUNC_COPY',`$4')
define(`__OPAQUE_FUNC_FREE',`$5')
define(`_CUSTOM_DEFAULT_CTOR',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_CUSTOM_DEFAULT_CTOR__',`$1')
_POP()
')
_POP()
_SECTION(SECTION_CLASS2)
') dnl End of _CLASS_OPAQUE_COPYABLE.
dnl
dnl _END_CLASS_OPAQUE_COPYABLE()
dnl denotes the end of a class
dnl
define(`_END_CLASS_OPAQUE_COPYABLE',`
_SECTION(SECTION_HEADER3)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates __NAMESPACE__::__CPPNAME__
*/
__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy = false);
} // namespace Glib
')dnl endif __BOOL_NO_WRAP_FUNCTION__
_SECTION(SECTION_SRC_GENERATED)
ifdef(`__BOOL_NO_WRAP_FUNCTION__',`dnl
',`dnl else
namespace Glib
{
__NAMESPACE__::__CPPNAME__ wrap(__CNAME__* object, bool take_copy /* = false */)
{
return __NAMESPACE__::__CPPNAME__`'(object, take_copy);
}
} // namespace Glib
')dnl endif
__NAMESPACE_BEGIN__
dnl
dnl The implementation:
dnl
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
',`dnl else
__CPPNAME__::__CPPNAME__`'()
:
ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
gobject_ (0) // Allows creation of invalid wrapper, e.g. for output arguments to methods.
',`dnl else
gobject_ (__OPAQUE_FUNC_NEW`'())
')dnl
{}
')dnl endif __BOOL_CUSTOM_DEFAULT_CTOR__
__CPPNAME__::__CPPNAME__`'(const __CPPNAME__& src)
:
gobject_ ((src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0)
{}
__CPPNAME__::__CPPNAME__`'(__CNAME__* castitem, bool make_a_copy /* = false */)
{
if(!make_a_copy)
{
// It was given to us by a function which has already made a copy for us to keep.
gobject_ = castitem;
}
else
{
// We are probably getting it via direct access to a struct,
// so we can not just take it - we have to take a copy of it.
if(castitem)
gobject_ = __OPAQUE_FUNC_COPY`'(castitem);
else
gobject_ = 0;
}
}
ifelse(__OPAQUE_FUNC_COPY,NONE,`dnl
',`dnl else
__CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& src)
{
__CNAME__ *const new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0;
if(gobject_)
__OPAQUE_FUNC_FREE`'(gobject_);
gobject_ = new_gobject;
return *this;
}
')dnl
__CPPNAME__::~__CPPNAME__`'()
{
if(gobject_)
__OPAQUE_FUNC_FREE`'(gobject_);
}
__CNAME__* __CPPNAME__::gobj_copy() const
{
return __OPAQUE_FUNC_COPY`'(gobject_);
}
_IMPORT(SECTION_CC)
__NAMESPACE_END__
dnl
dnl
dnl
dnl
_POP()
dnl
dnl
dnl The actual class, e.g. Pango::FontDescription, declaration:
dnl
_IMPORT(SECTION_CLASS1)
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __CNAME__ BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
ifdef(`__BOOL_CUSTOM_DEFAULT_CTOR__',`dnl
',`dnl else
__CPPNAME__`'();
')dnl
// Use make_a_copy=true when getting it directly from a struct.
explicit __CPPNAME__`'(__CNAME__* castitem, bool make_a_copy = false);
__CPPNAME__`'(const __CPPNAME__& src);
__CPPNAME__& operator=(const __CPPNAME__& src);
~__CPPNAME__`'();
__CNAME__* gobj() { return gobject_; }
const __CNAME__* gobj() const { return gobject_; }
///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
__CNAME__* gobj_copy() const;
protected:
__CNAME__* gobject_;
private:
_IMPORT(SECTION_CLASS2)
')

View file

@ -0,0 +1,175 @@
dnl $Id: class_opaque_refcounted.m4 413 2007-05-14 19:28:31Z murrayc $
dnl
dnl _CLASS_OPAQUE_REFCOUNTED(Coverage, PangoCoverage, pango_coverage_new, pango_coverage_ref, pango_coverage_unref)
dnl
define(`_CLASS_OPAQUE_REFCOUNTED',`dnl
_PUSH()
dnl
dnl Define the args for later macros
define(`__CPPNAME__',`$1')
define(`__CNAME__',`$2')
define(`__OPAQUE_FUNC_NEW',`$3')
define(`__OPAQUE_FUNC_REF',`$4')
define(`__OPAQUE_FUNC_UNREF',`$5')
_POP()
_SECTION(SECTION_CLASS2)
')dnl End of _CLASS_OPAQUE_REFCOUNTED.
dnl
dnl _END_CLASS_OPAQUE_REFCOUNTED()
dnl denotes the end of a class
dnl
define(`_END_CLASS_OPAQUE_REFCOUNTED',`
_SECTION(SECTION_HEADER3)
namespace Glib
{
/** A Glib::wrap() method for this object.
*
* @param object The C instance.
* @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
* @result A C++ instance that wraps this C instance.
*
* @relates __NAMESPACE__::__CPPNAME__
*/
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__* object, bool take_copy = false);
} // namespace Glib
_SECTION(SECTION_SRC_GENERATED)
/* Why reinterpret_cast<__CPPNAME__*>(gobject) is needed:
*
* A __CPPNAME__ instance is in fact always a __CNAME__ instance.
* Unfortunately, __CNAME__ cannot be a member of __CPPNAME__,
* because it is an opaque struct. Also, the C interface does not provide
* any hooks to install a destroy notification handler, thus we cannot
* wrap it dynamically either.
*
* The cast works because __CPPNAME__ does not have any member data, and
* it is impossible to derive from it. This is ensured by not implementing
* the (protected) default constructor. The ctor is protected rather than
* private just to avoid a compile warning.
*/
namespace Glib
{
Glib::RefPtr<__NAMESPACE__::__CPPNAME__> wrap(__CNAME__* object, bool take_copy)
{
if(take_copy && object)
__OPAQUE_FUNC_REF`'(object);
// See the comment at the top of this file, if you want to know why the cast works.
return Glib::RefPtr<__NAMESPACE__::__CPPNAME__>(reinterpret_cast<__NAMESPACE__::__CPPNAME__*>(object));
}
} // namespace Glib
__NAMESPACE_BEGIN__
dnl
dnl The implementation:
dnl
ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
',`dnl else
// static
Glib::RefPtr<__CPPNAME__> __CPPNAME__::create()
{
// See the comment at the top of this file, if you want to know why the cast works.
return Glib::RefPtr<__CPPNAME__>(reinterpret_cast<__CPPNAME__*>(__OPAQUE_FUNC_NEW`'()));
}
')dnl endif __OPAQUE_FUNC_NEW
void __CPPNAME__::reference() const
{
// See the comment at the top of this file, if you want to know why the cast works.
__OPAQUE_FUNC_REF`'(reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this)));
}
void __CPPNAME__::unreference() const
{
// See the comment at the top of this file, if you want to know why the cast works.
__OPAQUE_FUNC_UNREF`'(reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this)));
}
__CNAME__* __CPPNAME__::gobj()
{
// See the comment at the top of this file, if you want to know why the cast works.
return reinterpret_cast<__CNAME__*>(this);
}
const __CNAME__* __CPPNAME__::gobj() const
{
// See the comment at the top of this file, if you want to know why the cast works.
return reinterpret_cast<const __CNAME__*>(this);
}
__CNAME__* __CPPNAME__::gobj_copy() const
{
// See the comment at the top of this file, if you want to know why the cast works.
__CNAME__ *const gobject = reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this));
__OPAQUE_FUNC_REF`'(gobject);
return gobject;
}
_IMPORT(SECTION_CC)
__NAMESPACE_END__
dnl
dnl
dnl
dnl
_POP()
dnl
dnl
dnl The actual class, e.g. Pango::FontDescription, declaration:
dnl
_IMPORT(SECTION_CLASS1)
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __CNAME__ BaseObjectType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
ifelse(__OPAQUE_FUNC_NEW,NONE,`dnl
',`dnl else
static Glib::RefPtr<__CPPNAME__> create();
')dnl endif __OPAQUE_FUNC_NEW
// For use with Glib::RefPtr<> only.
void reference() const;
void unreference() const;
///Provides access to the underlying C instance.
__CNAME__* gobj();
///Provides access to the underlying C instance.
const __CNAME__* gobj() const;
///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
__CNAME__* gobj_copy() const;
protected:
// Do not derive this. __NAMESPACE__::__CPPNAME__ can neither be constructed nor deleted.
__CPPNAME__`'();
void operator delete(void*, size_t);
private:
// noncopyable
__CPPNAME__`'(const __CPPNAME__&);
__CPPNAME__& operator=(const __CPPNAME__&);
_IMPORT(SECTION_CLASS2)
')

View file

@ -0,0 +1,221 @@
dnl $Id: class_shared.m4 320 2006-09-19 20:07:31Z murrayc $
define(`_CLASS_START',`dnl
_PUSH(SECTION_CLASS1)
')
dnl
dnl
dnl
define(`_H_VFUNCS_AND_SIGNALS',`dnl
public:
//C++ methods used to invoke GTK+ virtual functions:
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_H_VFUNCS_CPPWRAPPER)
#endif //GLIBMM_VFUNCS_ENABLED
protected:
//GTK+ Virtual Functions (override these to change behaviour):
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_H_VFUNCS)
#endif //GLIBMM_VFUNCS_ENABLED
//Default Signal Handlers::
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
_IMPORT(SECTION_H_DEFAULT_SIGNAL_HANDLERS)
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
')
dnl
dnl
dnl
define(`_IMPLEMENTS_INTERFACE_CC',`dnl
_PUSH(SECTION_CC_IMPLEMENTS_INTERFACES)
ifelse(`$2',,,`#ifdef $2'
)dnl
$1`'::add_interface(get_type());
ifelse(`$2',,,`
#endif // $2
')dnl
_POP()
')
dnl
dnl
dnl
define(`_PH_CLASS_DECLARATION',`dnl
class __CPPNAME__`'_Class : public Glib::Class
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef __CPPNAME__ CppObjectType;
typedef __REAL_CNAME__ BaseObjectType;
ifdef(`__BOOL_NO_DERIVED_CLASS__',`dnl
',`dnl
typedef __REAL_CNAME__`'Class BaseClassType;
typedef __CPPPARENT__`'_Class CppClassParent;
typedef __REAL_CPARENT__`'Class BaseClassParent;
')dnl
friend class __CPPNAME__;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
const Glib::Class& init();
ifdef(`__BOOL_NO_DERIVED_CLASS__',`dnl
',`dnl
static void class_init_function(void* g_class, void* class_data);
')dnl
static Glib::ObjectBase* wrap_new(GObject*);
protected:
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
//Callbacks (default signal handlers):
//These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
//You could prevent the original default signal handlers being called by overriding the *_impl method.
_IMPORT(SECTION_PH_DEFAULT_SIGNAL_HANDLERS)
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
//Callbacks (virtual functions):
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_PH_VFUNCS)
#endif //GLIBMM_VFUNCS_ENABLED
};
')
dnl
dnl
dnl
define(`_PCC_CLASS_IMPLEMENTATION',`dnl
const Glib::Class& __CPPNAME__`'_Class::init()
{
if(!gtype_) // create the GType if necessary
{
// Glib::Class has to know the class init function to clone custom types.
class_init_func_ = &__CPPNAME__`'_Class::class_init_function;
// This is actually just optimized away, apparently with no harm.
// Make sure that the parent type has been created.
//CppClassParent::CppObjectType::get_type();
// Create the wrapper type, with the same class/instance size as the base type.
register_derived_type(_LOWER(__CCAST__)_get_type());
// Add derived versions of interfaces, if the C type implements any interfaces:
_IMPORT(SECTION_CC_IMPLEMENTS_INTERFACES)
}
return *this;
}
ifdef(`__BOOL_NO_DERIVED_CLASS__',`dnl
',`dnl
void __CPPNAME__`'_Class::class_init_function(void* g_class, void* class_data)
{
BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
CppClassParent::class_init_function(klass, class_data);
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS)
#endif //GLIBMM_VFUNCS_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
_IMPORT(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS)
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}
')dnl
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_PCC_VFUNCS)
#endif //GLIBMM_VFUNCS_ENABLED
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
_IMPORT(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS)
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
')
dnl
dnl
dnl
define(`_CC_CLASS_IMPLEMENTATION',`dnl
__CPPNAME__::CppClassType __CPPNAME__::`'__BASE__`'_class_; // initialize static member
GType __CPPNAME__::get_type()
{
return __BASE__`'_class_.init().get_type();
}
GType __CPPNAME__::get_base_type()
{
return _LOWER(__CCAST__)_get_type();
}
_IMPORT(SECTION_CC)
dnl _IMPORT(SECTION_CC_SIGNALPROXIES_CUSTOM)
_IMPORT(SECTION_CC_SIGNALPROXIES)
_IMPORT(SECTION_CC_PROPERTYPROXIES)
#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
_IMPORT(SECTION_CC_DEFAULT_SIGNAL_HANDLERS)
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#ifdef GLIBMM_VFUNCS_ENABLED
_IMPORT(SECTION_CC_VFUNCS)
_IMPORT(SECTION_CC_VFUNCS_CPPWRAPPER)
#endif //GLIBMM_VFUNCS_ENABLED
')
dnl _PARENT_GCLASS_FROM_OBJECT(object_instance_name)
define(`_PARENT_GCLASS_FROM_OBJECT',`dnl
g_type_class_peek_parent`'(G_OBJECT_GET_CLASS`'($1)) // Get the parent class of the object class (The original underlying C class).
')
dnl _IFACE_PARENT_FROM_OBJECT(object_instance_name)
define(`_IFACE_PARENT_FROM_OBJECT',`dnl
g_type_interface_peek_parent`'( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek`'(G_OBJECT_GET_CLASS`'($1), CppObjectType::get_type`'()) // Get the interface.
)dnl
')
dnl Bonobo doesn't use the "typedef struct _somestruct struct" system.
define(`_STRUCT_NOT_HIDDEN',`dnl
_PUSH()
dnl Define this macro to be tested for later.
define(`__BOOL_STRUCT_NOT_HIDDEN__',`$1')
_POP()
')
dnl _STRUCT_PROTOTYPE()
define(`_STRUCT_PROTOTYPE',`dnl
#ifndef DOXYGEN_SHOULD_SKIP_THIS
ifdef(`__BOOL_STRUCT_NOT_HIDDEN__',`dnl
',`dnl
typedef struct _`'__CNAME__ __CNAME__;
typedef struct _`'__CNAME__`'Class __CNAME__`'Class;
')dnl
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
')
dnl _GTKMMPROC_WIN32_NO_WRAP
dnl Just process it to remove it from the generated file.
dnl generate_wrap_init.pl will look for this in the original .hg file.
dnl
define(`_GTKMMPROC_WIN32_NO_WRAP', dnl
`//This is not available in on Win32.
//This source file will not be compiled,
//and the class will not be registered in wrap_init.h or wrap_init.cc
')dnl

View file

@ -0,0 +1,118 @@
dnl $Id: compare.m4 58 2003-12-14 11:53:04Z murrayc $
define(`__OPERATOR_DECL',`dnl
/** @relates __NAMESPACE__::__CPPNAME__
* @param lhs The left-hand side
* @param rhs The right-hand side
* @result The result
*/
bool operator`'$1`'(const __CPPNAME__& lhs, const __CPPNAME__& rhs);
')
define(`__OPERATOR_IMPL',`dnl
bool operator`'$1`'(const __CPPNAME__& lhs, const __CPPNAME__& rhs)
{'
ifelse`'(`__UNCONST__',`unconst',`dnl
return ($2`'(const_cast<__CNAME__*>(lhs.gobj()), const_cast<__CNAME__*>(rhs.gobj())) $3);
',`dnl else
return ($2`'(lhs.gobj(), rhs.gobj()) $3);
')`dnl endif
}
')
dnl
dnl _WRAP_EQUAL(gdk_region_equal, unconst)
dnl
define(`_WRAP_EQUAL',`dnl
pushdef(`__FUNC_EQUAL__',$1)dnl
pushdef(`__UNCONST__',$2)dnl
_PUSH(SECTION_HEADER3)
__NAMESPACE_BEGIN__
__OPERATOR_DECL(`==')
__OPERATOR_DECL(`!=')
__NAMESPACE_END__
_SECTION(SECTION_CC)
__OPERATOR_IMPL(`==', __FUNC_EQUAL__, `!= 0')
__OPERATOR_IMPL(`!=', __FUNC_EQUAL__, `== 0')
_POP()
popdef(`__UNCONST__')dnl
popdef(`__FUNC_EQUAL__')dnl
')dnl enddef _WRAP_EQUAL
dnl
dnl _WRAP_COMPARE(gtk_tree_path_compare)
dnl
define(`_WRAP_COMPARE',`dnl
pushdef(`__FUNC_COMPARE__',$1)dnl
pushdef(`__UNCONST__',$2)dnl
_PUSH(SECTION_HEADER3)
__NAMESPACE_BEGIN__
__OPERATOR_DECL(`==')
__OPERATOR_DECL(`!=')
__OPERATOR_DECL(`<')
__OPERATOR_DECL(`>')
__OPERATOR_DECL(`<=')
__OPERATOR_DECL(`>=')
__NAMESPACE_END__
_SECTION(SECTION_CC)
__OPERATOR_IMPL(`==', __FUNC_COMPARE__, `== 0')
__OPERATOR_IMPL(`!=', __FUNC_COMPARE__, `!= 0')
__OPERATOR_IMPL(`<', __FUNC_COMPARE__, `< 0')
__OPERATOR_IMPL(`>', __FUNC_COMPARE__, `> 0')
__OPERATOR_IMPL(`<=', __FUNC_COMPARE__, `<= 0')
__OPERATOR_IMPL(`>=', __FUNC_COMPARE__, `>= 0')
_POP()
popdef(`__UNCONST__')dnl
popdef(`__FUNC_COMPARE__')dnl
')dnl enddef _WRAP_COMPARE
dnl
dnl _WRAP_EQUAL_AND_COMPARE(gtk_text_iter_equal, gtk_text_iter_compare)
dnl
define(`_WRAP_EQUAL_AND_COMPARE',`dnl
pushdef(`__FUNC_EQUAL__',$1)dnl
pushdef(`__FUNC_COMPARE__',$2)dnl
pushdef(`__UNCONST__',$3)dnl
_PUSH(SECTION_HEADER3)
__NAMESPACE_BEGIN__
__OPERATOR_DECL(`==')
__OPERATOR_DECL(`!=')
__OPERATOR_DECL(`<')
__OPERATOR_DECL(`>')
__OPERATOR_DECL(`<=')
__OPERATOR_DECL(`>=')
__NAMESPACE_END__
_SECTION(SECTION_CC)
__OPERATOR_IMPL(`==', __FUNC_EQUAL__, `!= 0')
__OPERATOR_IMPL(`!=', __FUNC_EQUAL__, `== 0')
__OPERATOR_IMPL(`<', __FUNC_COMPARE__, `< 0')
__OPERATOR_IMPL(`>', __FUNC_COMPARE__, `> 0')
__OPERATOR_IMPL(`<=', __FUNC_COMPARE__, `<= 0')
__OPERATOR_IMPL(`>=', __FUNC_COMPARE__, `>= 0')
_POP()
popdef(`__UNCONST__')dnl
popdef(`__FUNC_COMPARE__')dnl
popdef(`__FUNC_EQUAL__')dnl
')dnl enddef _WRAP_EQUAL_AND_COMPARE

View file

@ -0,0 +1,6 @@
dnl $Id: convert.m4 2 2003-01-07 16:59:16Z murrayc $
# Other libraries, such as libgnomeuimm, can provide their own convert.m4 files,
# Maybe choosing to include the same files as this one.
include(convert_gtkmm.m4)

View file

@ -0,0 +1,34 @@
include(convert_glib.m4)
_EQUAL(State,AtkState)
_CONV_ENUM(Atk,Role)
_CONV_ENUM(Atk,Layer)
_CONV_ENUM(Atk,RelationType)
_CONV_ENUM(Atk,StateType)
_CONV_ENUM(Atk,CoordType)
_CONV_ENUM(Atk,TextBoundary)
_CONVERSION(`AtkObject*',`Glib::RefPtr<Atk::Object>',Glib::wrap($3))
_CONVERSION(`AtkObject*',`Glib::RefPtr<Object>',Glib::wrap($3))
_CONVERSION(`AtkObject*',`Glib::RefPtr<Atk::Object>',Glib::wrap($3))
_CONVERSION(`AtkObject*',`Glib::RefPtr<const Object>',Glib::wrap($3))
_CONVERSION(`AtkObject*',`Glib::RefPtr<const Atk::Object>',Glib::wrap($3))
_CONVERSION(`AtkObject*',`const Glib::RefPtr<Atk::Object>&',`Glib::wrap($3, true)')
_CONVERSION(`const Glib::RefPtr<Object>&',`AtkObject*',`Glib::unwrap($3)')
_CONVERSION(`const Glib::RefPtr<Atk::Object>&',`AtkObject*',`Glib::unwrap($3)')
_CONVERSION(`Glib::RefPtr<Atk::Object>',`AtkObject*',`Glib::unwrap($3)')
_CONVERSION(`Glib::RefPtr<Object>',`AtkObject*',`Glib::unwrap($3)')
_CONVERSION(`AtkRelationSet*',`Glib::RefPtr<RelationSet>',Glib::wrap($3))
_CONVERSION(`const Glib::RefPtr<Relation>&',`AtkRelation*',`Glib::unwrap($3)')
_CONVERSION(`AtkRelation*',`Glib::RefPtr<Relation>',Glib::wrap($3))
_CONVERSION(`AtkStateSet*',`Glib::RefPtr<StateSet>',Glib::wrap($3))
_CONVERSION(`const Glib::RefPtr<StateSet>&',`AtkStateSet*',`Glib::unwrap($3)')
_CONVERSION(`AtkGObjectAccessible*',`Glib::RefPtr<ObjectAccessible>',Glib::wrap($3))
_CONVERSION(`AtkGObjectAccessible*',`Glib::RefPtr<const ObjectAccessible>',Glib::wrap($3))
_CONVERSION(`AtkAttributeSet*', `AttributeSet', `AttributeSet($3, Glib::OWNERSHIP_DEEP)')
_CONVERSION(`const AttributeSet&', `AtkAttributeSet*', `($3).data()')

View file

@ -0,0 +1,71 @@
dnl $Id: convert_base.m4 293 2006-05-16 19:49:07Z murrayc $
#
# Define a hashing for names
#
define(`__HASH',`__`'m4_translit(`$*',`ABCDEFGHIJKLMNOPQRSTUVWXYZ<>[]&*, ',`abcdefghijklmnopqrstuvwxyzVBNMRSC_')`'')
define(`__EQUIV',`m4_ifdef(EV`'__HASH(`$1'),EV`'__HASH(`$1'),`$1')')
define(`__HASH2',`dnl
pushdef(`__E1',__EQUIV(`$1'))pushdef(`__E2',__EQUIV(`$2'))dnl
m4_ifelse(__E1,__E2,`__EQ',__HASH(__E1)`'__HASH(__E2))`'dnl
popdef(`__E1')popdef(`__E2')`'')
define(`CF__EQ',`$3')
#
# _CONVERT(fromtype, totype, name, wrap_line)
# Print the conversion from ctype to cpptype
define(`_CONVERT',`dnl
m4_ifelse(`$2',void,`$3',`dnl
pushdef(`__COV',`CF`'__HASH2(`$1',`$2')')dnl
m4_ifdef(__COV,`m4_indir(__COV,`$1',`$2',`$3')',`
m4_errprint(`No conversion from $1 to $2 defined (line: $4, parameter name: $3)
')
m4_m4exit(1)
')`'dnl
')`'dnl
')
#
# Functions for populating the tables.
#
define(`_CONVERSION',`
m4_ifelse(`$3',,,`define(CF`'__HASH2(`$1',`$2'),`$3')')
')
define(`_EQUAL',`define(EV`'__HASH(`$1'),`$2')')
/*******************************************************************/
define(`__ARG3__',`$`'3')
define(`_CONV_ENUM',`dnl
_CONVERSION(`$1$2', `$2', (($2)(__ARG3__)))
_CONVERSION(`$1$2', `$1::$2', (($1::$2)(__ARG3__)))
_CONVERSION(`$2', `$1$2', (($1$2)(__ARG3__)))
_CONVERSION(`$1::$2', `$1$2', (($1$2)(__ARG3__)))
')dnl
# e.g. Glib::RefPtr<Gdk::Something> to GdkSomething*
define(`__CONVERT_REFPTR_TO_P',`Glib::unwrap($`'3)')
# e.g. Glib::RefPtr<const Gdk::Something> to GdkSomething*
#define(`__CONVERT_CONST_REFPTR_TO_P',`const_cast<$`'2>($`'3->gobj())')
define(`__CONVERT_CONST_REFPTR_TO_P',`const_cast<$`'2>(Glib::unwrap($`'3))')
# The Sun Forte compiler doesn't seem to be able to handle these, so we are using the altlernative, __CONVERT_CONST_REFPTR_TO_P_SUN.
# The Sun compiler gives this error, for instance:
#  "widget.cc", line 4463: Error: Overloading ambiguity between "Glib::unwrap<Gdk::Window>(const Glib::RefPtr<const Gdk::Window>&)" and
# "Glib::unwrap<const Gdk::Window>(const Glib::RefPtr<const Gdk::Window>&)".
#
define(`__CONVERT_CONST_REFPTR_TO_P_SUN',`const_cast<$`'2>(Glib::unwrap<$1>($`'3))')
include(convert_gtk.m4)
include(convert_pango.m4)
include(convert_gdk.m4)
include(convert_atk.m4)
include(convert_glib.m4)

View file

@ -0,0 +1,231 @@
include(convert_glib.m4)
_EQUAL(gint8[],gint8*)
_EQUAL(guchar,guint8)
_EQUAL(guchar*,guint8*)
_EQUAL(gfloat,float)
# Enums
_CONV_ENUM(Gdk,AxisUse)
_CONV_ENUM(Gdk,ByteOrder)
_CONV_ENUM(Gdk,CapStyle)
_CONV_ENUM(Gdk,Colorspace)
_CONV_ENUM(Gdk,CursorType)
_CONV_ENUM(Gdk,DragAction)
_CONV_ENUM(Gdk,DragProtocol)
_CONV_ENUM(Gdk,EventMask)
_CONV_ENUM(Gdk,EventType)
_CONV_ENUM(Gdk,ExtensionMode)
_CONV_ENUM(Gdk,Fill)
_CONV_ENUM(Gdk,FillRule)
_CONV_ENUM(Gdk,Function)
_CONV_ENUM(Gdk,GCValuesMask)
_CONV_ENUM(Gdk,Gravity)
_CONV_ENUM(Gdk,ImageType)
_CONV_ENUM(Gdk,InputCondition)
_CONV_ENUM(Gdk,InputMode)
_CONV_ENUM(Gdk,InterpType)
_CONV_ENUM(Gdk,JoinStyle)
_CONV_ENUM(Gdk,LineStyle)
_CONV_ENUM(Gdk,ModifierType)
_CONV_ENUM(Gdk,OverlapType)
_CONV_ENUM(Gdk,PixbufAlphaMode)
_CONV_ENUM(Gdk,RgbDither)
_CONV_ENUM(Gdk,Status)
_CONV_ENUM(Gdk,SubwindowMode)
_CONV_ENUM(Gdk,VisualType)
_CONV_ENUM(Gdk,WindowAttributesType)
_CONV_ENUM(Gdk,WindowEdge)
_CONV_ENUM(Gdk,WindowHints)
_CONV_ENUM(Gdk,WindowState)
_CONV_ENUM(Gdk,WindowType)
_CONV_ENUM(Gdk,WindowTypeHint)
_CONV_ENUM(Gdk,WMDecoration)
_CONV_ENUM(Gdk,WMFunction)
_CONV_ENUM(Gdk,GrabStatus)
_CONVERSION(`Gdk::EventMask',`gint',`$3')
_CONVERSION(`gint',`Gdk::EventMask',`static_cast<Gdk::EventMask>($3)')
_CONVERSION(`ModifierType&',`GdkModifierType*',`(($2) &($3))')
_CONVERSION(`WMDecoration&',`GdkWMDecoration*',`(($2) &($3))')
_CONVERSION(`GdkDragProtocol&',`GdkDragProtocol*',`&($3)')
_CONVERSION(`GdkRectangle&',`GdkRectangle*',`&$3',`*$3')
_CONVERSION(`GdkRgbCmap&',`GdkRgbCmap*',`&$3',`*$3')
# TODO: Remove this, and use Gdk::Device:
_CONVERSION(`GdkDevice*',`const GdkDevice*',`$3')
_CONVERSION(`GdkKeymap*',`const GdkKeymap*',`$3')
# for GtkStyle public struct members
_CONVERSION(`Gdk::Color',`GdkColor', `(*($3).gobj())')
_CONVERSION(`GdkColor',`Gdk::Color', `Gdk::Color(const_cast<GdkColor*>(&($3)), true)')
# Ref (gdkmm) -> Ptr (gtk+)
_CONVERSION(`Color&',`GdkColor*',($3).gobj())
_CONVERSION(`Rectangle&',`GdkRectangle*',($3).gobj())
_CONVERSION(`Gdk::Rectangle&',`GdkRectangle*',($3).gobj())
_CONVERSION(`Font&',`GdkFont*',($3).gobj())
_CONVERSION(`Region&',`GdkRegion*',($3).gobj())
_CONVERSION(`const Glib::RefPtr<Gdk::Colormap>&',`GdkColormap*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::Pixmap>&',`GdkPixmap*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::Window>&',`GdkWindow*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Window>&',`GdkWindow*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Pixmap>&',`GdkPixmap*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::Pixmap>&',`GdkPixmap*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Bitmap>&',`GdkBitmap*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::Bitmap>&',`GdkBitmap*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Colormap>&',`GdkColormap*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Colormap>&',`GdkColormap*',__CONVERT_CONST_REFPTR_TO_P_SUN(Colormap))
_CONVERSION(`const Glib::RefPtr<GC>&',`GdkGC*',`Glib::unwrap<Gdk::GC>($3)')
_CONVERSION(`const Glib::RefPtr<const GC>&',`GdkGC*',__CONVERT_CONST_REFPTR_TO_P_SUN(GC))
_CONVERSION(`const Glib::RefPtr<Gdk::GC>&',`GdkGC*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Drawable>&',`GdkDrawable*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Drawable>&',`GdkDrawable*',__CONVERT_CONST_REFPTR_TO_P_SUN(Drawable))
_CONVERSION(`const Glib::RefPtr<Image>&',`GdkImage*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Image>&',`GdkImage*',__CONVERT_CONST_REFPTR_TO_P_SUN(Image))
_CONVERSION(`const Glib::RefPtr<Gdk::Image>&',`GdkImage*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Pixbuf>&',`GdkPixbuf*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Pixbuf>&',`GdkPixbuf*',__CONVERT_CONST_REFPTR_TO_P_SUN(Pixbuf))
_CONVERSION(`const Glib::RefPtr<Gdk::Pixbuf>&',`GdkPixbuf*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`Glib::RefPtr<Gdk::Pixbuf>',`GdkPixbuf*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::PixbufAnimation>&',`GdkPixbufAnimation*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::PixbufAnimationIter>&',`GdkPixbufAnimationIter*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::DragContext>&',`GdkDragContext*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Display>&',`GdkDisplay*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Screen>&',`GdkScreen*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::Display>&',`GdkDisplay*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Gdk::Screen>&',`GdkScreen*',__CONVERT_REFPTR_TO_P)
define(`__CFR2P',`const_cast<$`'2>($`'3.gobj())')
_CONVERSION(const Font&,GdkFont*,__CFR2P)
_CONVERSION(const Gdk::Color&,GdkColor*,__CFR2P)
_CONVERSION(const Color&,GdkColor*,__CFR2P)
_CONVERSION(const Gdk::Rectangle&,GdkRectangle*,__CFR2P)
_CONVERSION(const Rectangle&,GdkRectangle*,__CFR2P)
_CONVERSION(const Gdk::Geometry&,GdkGeometry*,const_cast<$2>(&($3)))
_CONVERSION(const Geometry&,GdkGeometry*,const_cast<$2>(&($3)))
_CONVERSION(const RgbCmap&,GdkRgbCmap*,__CFR2P)
_CONVERSION(`Gdk::Rectangle*',`GdkRectangle*',`Glib::unwrap($3)')
_CONVERSION(`const Gdk::Rectangle*',`GdkRectangle*',`Glib::unwrap(const_cast<Gdk::Rectangle*>($3))')
_CONVERSION(`GdkRectangle*',`Gdk::Rectangle*',`&Glib::wrap($3)')
_CONVERSION(`GdkRectangle*',`const Gdk::Rectangle*',`&Glib::wrap($3)')
_CONVERSION(`GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
dnl TODO: Should this always be a copy?
_CONVERSION(const Cursor&,GdkCursor*,($3).gobj_copy())
# Special treatment for the Sun Forte compiler
#_CONVERSION(const Glib::RefPtr<const Gdk::Pixmap>&,GdkPixmap*,__CONVERT_CONST_REFPTR_TO_P)
#_CONVERSION(const Glib::RefPtr<const Gdk::Window>&,GdkWindow*,__CONVERT_CONST_REFPTR_TO_P)
#_CONVERSION(const Glib::RefPtr<const Gdk::Colormap>&,GdkColormap*,__CONVERT_CONST_REFPTR_TO_P)
#_CONVERSION(const Glib::RefPtr<const Gdk::Visual>&,GdkVisual*,__CONVERT_CONST_REFPTR_TO_P)
#_CONVERSION(const Glib::RefPtr<const Gdk::Bitmap>&,GdkBitmap*,__CONVERT_CONST_REFPTR_TO_P)
#_CONVERSION(const Glib::RefPtr<const Gdk::Image>&,GdkImage*,__CONVERT_CONST_REFPTR_TO_P)
#_CONVERSION(const Glib::RefPtr<const Gdk::GC>&,GdkGC*,__CONVERT_CONST_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Gdk::Pixmap>&', `GdkPixmap*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Pixmap))
_CONVERSION(`const Glib::RefPtr<const Gdk::Window>&', `GdkWindow*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Window))
_CONVERSION(`const Glib::RefPtr<const Window>&', `GdkWindow*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Window))
_CONVERSION(`const Glib::RefPtr<const Gdk::Colormap>&', `GdkColormap*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Colormap))
_CONVERSION(`const Glib::RefPtr<const Gdk::Visual>&', `GdkVisual*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Visual))
_CONVERSION(`const Glib::RefPtr<const Gdk::Bitmap>&', `GdkBitmap*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Bitmap))
_CONVERSION(`const Glib::RefPtr<const Gdk::Image>&', `GdkImage*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Image))
_CONVERSION(`const Glib::RefPtr<const Image>&', `GdkImage*',__CONVERT_CONST_REFPTR_TO_P_SUN(Image))
_CONVERSION(`const Glib::RefPtr<const Gdk::GC>&', `GdkGC*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::GC))
_CONVERSION(`const Glib::RefPtr<const GC>&', `GdkGC*',__CONVERT_CONST_REFPTR_TO_P_SUN(GC))
#_CONVERSION(`const Glib::RefPtr<const Gdk::Drawable>&', `GdkDrawable*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gdk::Drawable))
#_CONVERSION(`const Glib::RefPtr<const Drawable>&', `GdkDrawable*',__CONVERT_CONST_REFPTR_TO_P_SUN(Drawable))
#_CONVERSION(`const Glib::RefPtr<const Display>&', `GdkDrawable*',__CONVERT_CONST_REFPTR_TO_P_SUN(Drawable))
_CONVERSION(`GdkWindow*',`Glib::RefPtr<Window>', `Glib::wrap((GdkWindowObject*)($3))')
_CONVERSION(`GdkWindow*',`Glib::RefPtr<const Window>', `Glib::wrap((GdkWindowObject*)($3))')
_CONVERSION(`GdkWindow*',`Glib::RefPtr<Gdk::Window>', `Glib::wrap((GdkWindowObject*)($3))')
_CONVERSION(`GdkWindow*',`Glib::RefPtr<const Gdk::Window>', `Glib::wrap((GdkWindowObject*)($3))')
_CONVERSION(`GdkWindow*',`const Glib::RefPtr<Gdk::Window>&', `Glib::wrap((GdkWindowObject*)($3), true)')
_CONVERSION(`GdkPixmap*',`Glib::RefPtr<Pixmap>', `Glib::wrap((GdkPixmapObject*)($3))')
_CONVERSION(`GdkPixmap*',`Glib::RefPtr<const Pixmap>', `Glib::wrap((GdkPixmapObject*)($3))')
_CONVERSION(`GdkPixmap*',`Glib::RefPtr<const Gdk::Pixmap>', `Glib::wrap((GdkPixmapObject*)($3))')
_CONVERSION(`GdkPixmap*',`Glib::RefPtr<Gdk::Pixmap>', `Glib::wrap((GdkPixmapObject*)($3))')
_CONVERSION(`GdkColormap*',`Glib::RefPtr<Colormap>', `Glib::wrap($3)')
_CONVERSION(`GdkColormap*',`Glib::RefPtr<const Colormap>', `Glib::wrap($3)')
_CONVERSION(`GdkColormap*',`Glib::RefPtr<Gdk::Colormap>', `Glib::wrap($3)')
_CONVERSION(`GdkVisual*',`Glib::RefPtr<Gdk::Visual>', `Glib::wrap($3)')
_CONVERSION(`GdkVisual*',`Glib::RefPtr<Visual>', `Glib::wrap($3)')
_CONVERSION(`GdkVisual*',`Glib::RefPtr<const Visual>', `Glib::wrap($3)')
_CONVERSION(`GdkImage*',`Glib::RefPtr<Image>', `Glib::wrap($3)')
_CONVERSION(`GdkPixbuf*',`Glib::RefPtr<Pixbuf>', `Glib::wrap($3)')
_CONVERSION(`GdkPixbuf*',`Glib::RefPtr<Gdk::Pixbuf>', `Glib::wrap($3)')
_CONVERSION(`GdkPixbufAnimationIter*',`Glib::RefPtr<PixbufAnimationIter>', `Glib::wrap($3)')
_CONVERSION(`GdkPixbuf*',`Glib::RefPtr<Gdk::Pixbuf>', Glib::wrap($3))
_CONVERSION(`GdkPixbufAnimation*',`Glib::RefPtr<Gdk::PixbufAnimation>', `Glib::wrap($3)')
_CONVERSION(`GdkGC*',`Glib::RefPtr<Gdk::GC>', `Glib::wrap($3)')
_CONVERSION(`GdkGC*',`Glib::RefPtr<const Gdk::GC>', `Glib::wrap($3)')
_CONVERSION(`GdkDisplay*',`Glib::RefPtr<Display>', `Glib::wrap($3)')
_CONVERSION(`GdkDisplay*',`Glib::RefPtr<const Display>', `Glib::wrap($3)')
_CONVERSION(`GdkDisplay*',`Glib::RefPtr<Gdk::Display>', `Glib::wrap($3)')
_CONVERSION(`GdkDisplay*',`Glib::RefPtr<const Gdk::Display>', `Glib::wrap($3)')
_CONVERSION(`GdkDisplayManager*',`Glib::RefPtr<DisplayManager>', `Glib::wrap($3)')
_CONVERSION(`GdkDisplayManager*',`Glib::RefPtr<const DisplayManager>', `Glib::wrap($3)')
_CONVERSION(`GdkScreen*',`Glib::RefPtr<Screen>', `Glib::wrap($3)')
_CONVERSION(`GdkScreen*',`Glib::RefPtr<const Screen>', `Glib::wrap($3)')
_CONVERSION(`GdkScreen*',`Glib::RefPtr<Gdk::Screen>', `Glib::wrap($3)')
_CONVERSION(`GdkScreen*',`Glib::RefPtr<const Gdk::Screen>', `Glib::wrap($3)')
_CONVERSION(`GdkDevice*',`Glib::RefPtr<Device>', `Glib::wrap($3)')
_CONVERSION(`GdkDevice*',`Glib::RefPtr<const Device>', `Glib::wrap($3)')
# Glib::ListHandle<> (gdkmm) -> GList (gdk)
_CONVERSION(`const Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >&',`GList*',`$3.data()')
# GList (gdk) -> Glib::ListHandle<> (gdkmm)
_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Gdk::Pixbuf> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Device> >',`$2($3, Glib::OWNERSHIP_DEEP)')
_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Visual> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
_CONVERSION(`GList*',`Glib::ListHandle< Glib::RefPtr<Window> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
_CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<Display> >',`$2($3, Glib::OWNERSHIP_SHALLOW)')
# XPM data
_CONVERSION(`const char*const*',`const char**',`const_cast<const char**>($3)',`$3')
_CONVERSION(GdkFont*, Gdk::Font, `Gdk::Font($3)')
_CONVERSION(GdkEvent*, Event, `Event($3)')
_CONVERSION(GdkRegion*, Region, `Region($3)')
_CONVERSION(`GdkTimeCoord**&',`GdkTimeCoord***',`&($3)')
dnl _CONVERSION(GdkPixmap*,Gdk::Pixmap&,`Glib::unwrap_boxed($3)',`$3')
dnl _CONVERSION(GdkBitmap*,Gdk::Bitmap&,`Glib::unwrap_boxed($3)',`$3')
# Used by signals:
_CONVERSION(`GdkDragContext*',`const Glib::RefPtr<Gdk::DragContext>&',Glib::wrap($3, true))
_CONVERSION(`GdkPixbuf*',`const Glib::RefPtr<Gdk::Pixbuf>&', Glib::wrap($3, true))
_CONVERSION(`GdkDragContext*',`Glib::RefPtr<Gdk::DragContext>',Glib::wrap($3, true))
_CONVERSION(`GdkDisplay*',`const Glib::RefPtr<Display>&', Glib::wrap($3, true))

View file

@ -0,0 +1,69 @@
dnl
dnl Glib C names have prefix 'G' but C++ namespace Glib
dnl
define(`_CONV_GLIB_ENUM',`dnl
_CONVERSION(`G$1', `$1', (($1)(__ARG3__)))
_CONVERSION(`G$1', `Glib::$1', ((Glib::$1)(__ARG3__)))
_CONVERSION(`$1', `G$1', ((G$1)(__ARG3__)))
_CONVERSION(`Glib::$1', `G$1', ((G$1)(__ARG3__)))
')dnl
_EQUAL(gchar,char)
_EQUAL(gchar*,char*)
_EQUAL(gchar**,char**)
_EQUAL(gint**,int**)
_EQUAL(gchar**,char*[])
_EQUAL(const gchar*,const char*)
_EQUAL(const-gchar*,const char*)
_EQUAL(gpointer*,void**)
_CONV_GLIB_ENUM(IOStatus)
_CONV_GLIB_ENUM(IOFlags)
_CONV_GLIB_ENUM(IOCondition)
_CONV_GLIB_ENUM(SeekType)
_CONV_GLIB_ENUM(OptionArg)
_CONV_GLIB_ENUM(KeyFileFlags)
_CONV_GLIB_ENUM(RegexCompileFlags)
_CONV_GLIB_ENUM(RegexMatchFlags)
_CONVERSION(`gunichar&',`gunichar*',`&($3)')
_CONVERSION(`gsize&',`gsize*',`&($3)')
# Strings:
define(`__GCHARP_TO_USTRING',`Glib::convert_const_gchar_ptr_to_ustring($`'3)')
define(`__GCHARP_TO_STDSTRING',`Glib::convert_const_gchar_ptr_to_stdstring($`'3)')
_CONVERSION(`const Glib::ustring&',`const char*',`$3.c_str()')
_CONVERSION(`const std::string&',`const char*',`$3.c_str()')
_CONVERSION(`const Glib::ustring&',`gchar*',`const_cast<gchar*>($3.c_str())')
_CONVERSION(`gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
_CONVERSION(`const-gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
_CONVERSION(`const gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
_CONVERSION(`const char*',`Glib::ustring',__GCHARP_TO_USTRING)
_CONVERSION(`const char*',`std::string',__GCHARP_TO_STDSTRING)
_CONVERSION(`const gchar*',`const Glib::ustring&',__GCHARP_TO_USTRING)
_CONVERSION(`const char*',`const-gchar*',`$3')
_CONVERSION(`const-gchar*',`const char*',`$3')
_CONVERSION(`return-gchar*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
_CONVERSION(`return-gchar*',`std::string',`Glib::convert_return_gchar_ptr_to_stdstring($3)')
_CONVERSION(`return-char*',`Glib::ustring',`Glib::convert_return_gchar_ptr_to_ustring($3)')
_CONVERSION(`const Glib::RefPtr<Glib::Object>&',`GObject*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Glib::Object>&',`GObject*',__CONVERT_CONST_REFPTR_TO_P_SUN(Glib::Object))
_CONVERSION(`GObject*',`Glib::RefPtr<Glib::Object>',`Glib::wrap($3)')
_CONVERSION(`GObject*',`Glib::RefPtr<const Glib::Object>',`Glib::wrap($3)')
_CONVERSION(`GRegex*',`Glib::RefPtr<Regex>',`Glib::wrap($3)')
_CONVERSION(`GRegex*',`Glib::RefPtr<const Regex>',`Glib::wrap($3)')
_CONVERSION(`Glib::ValueBase&',`GValue*',`($3).gobj()')
_CONVERSION(`const Glib::ValueBase&',`const GValue*',`($3).gobj()')
_CONVERSION(`const Glib::ValueBase&',`GValue*',`const_cast<GValue*>(($3).gobj())')
_CONVERSION(`GValue*', `Glib::ValueBase&', `*reinterpret_cast<Glib::ValueBase*>($3)')
_CONVERSION(`const GValue*', `const Glib::ValueBase&', `*reinterpret_cast<const Glib::ValueBase*>($3)')
_CONVERSION(`OptionGroup&',`GOptionGroup*',`($3).gobj()')
#_CONVERSION(`GOptionGroup*',`OptionGroup',`Glib::wrap(($3), true /* take_copy */)')

View file

@ -0,0 +1,394 @@
dnl $Id: convert_gtk.m4 35 2003-05-02 16:07:24Z murrayc $
include(convert_glib.m4)
#
# Table of widgets
#
_EQUAL(gboolean,int)
_EQUAL(gint,int)
_EQUAL(gint*,int*)
_EQUAL(gint&,int&)
_EQUAL(guint,unsigned int)
_EQUAL(guint*,unsigned int*)
_EQUAL(guint&,unsigned int&)
_EQUAL(gdouble,double)
_EQUAL(gdouble*,double*)
_EQUAL(gfloat, float)
_EQUAL(float*,gfloat[])
_EQUAL(GdkAtom,Gdk::Atom)
_EQUAL(const-char*,const-gchar*)
_EQUAL(return-char*,return-gchar*)
_EQUAL(gpointer,void*)
_EQUAL(gconstpointer,const void*)
#
# Basic Types
_CONVERSION(`int',`bool',`$3')
_CONVERSION(`bool',`int',`static_cast<int>($3)')
_CONVERSION(`unsigned int',`bool',`$3')
_CONVERSION(`bool',`unsigned int',`static_cast<unsigned int>($3)')
_CONVERSION(`int&',`gint*',`&($3)')
_CONVERSION(`gint*',`int&',`*($3)')
_CONVERSION(`guint&',`guint*',`&($3)')
_CONVERSION(`double&',`gdouble*',`&($3)')
_CONVERSION(`float&',`gfloat*',`&($3)')
_CONVERSION(`gchar**',`char**',`$3')
_CONVERSION(`char**',`gchar**',`$3')
_CONVERSION(`gpointer&',`gpointer*',`&($3)')
_CONVERSION(`void*&',`gpointer*',`&($3)')
_CONVERSION(`GError*&',`GError**',`&($3)')
# Enums:
_CONV_ENUM(Gtk,AccelFlags)
_CONV_ENUM(Gtk,ArrowType)
_CONV_ENUM(Gtk,AttachOptions)
_CONV_ENUM(Gtk,ButtonBoxStyle)
_CONV_ENUM(Gtk,ButtonsType)
_CONV_ENUM(Gtk,CalendarDisplayOptions)
_CONV_ENUM(Gtk,CellRendererMode)
_CONV_ENUM(Gtk,CellRendererState)
_CONV_ENUM(Gtk,CornerType)
_CONV_ENUM(Gtk,CurveType)
_CONV_ENUM(Gtk,DeleteType)
_CONV_ENUM(Gtk,DestDefaults)
_CONV_ENUM(Gtk,DirectionType)
_CONV_ENUM(Gtk,ExpanderStyle)
_CONV_ENUM(Gtk,ImageType)
_CONV_ENUM(Gtk,Justification)
_CONV_ENUM(Gtk,MenuDirectionType)
_CONV_ENUM(Gtk,MessageType)
_CONV_ENUM(Gtk,MetricType)
_CONV_ENUM(Gtk,MovementStep)
_CONV_ENUM(Gtk,NotebookTab)
_CONV_ENUM(Gtk,Orientation)
_CONV_ENUM(Gtk,PackType)
_CONV_ENUM(Gtk,PolicyType)
_CONV_ENUM(Gtk,PositionType)
_CONV_ENUM(Gtk,PreviewType)
_CONV_ENUM(Gtk,ProgressBarOrientation)
_CONV_ENUM(Gtk,ProgressBarStyle)
_CONV_ENUM(Gtk,ReliefStyle)
_CONV_ENUM(Gtk,ResizeMode)
_CONV_ENUM(Gtk,ScrollType)
_CONV_ENUM(Gtk,SelectionMode)
_CONV_ENUM(Gtk,ShadowType)
_CONV_ENUM(Gtk,SizeGroupMode)
_CONV_ENUM(Gtk,SortType)
_CONV_ENUM(Gtk,SpinButtonUpdatePolicy)
_CONV_ENUM(Gtk,SpinType)
_CONV_ENUM(Gtk,StateType)
_CONV_ENUM(Gtk,TextDirection)
_CONV_ENUM(Gtk,TextSearchFlags)
_CONV_ENUM(Gtk,TextWindowType)
_CONV_ENUM(Gtk,ToolbarChildType)
_CONV_ENUM(Gtk,ToolbarStyle)
_CONV_ENUM(Gtk,TreeModelFlags)
_CONV_ENUM(Gtk,TreeViewColumnSizing)
_CONV_ENUM(Gtk,TreeViewDropPosition)
_CONV_ENUM(Gtk,UpdateType)
_CONV_ENUM(Gtk,Visibility)
_CONV_ENUM(Gtk,WidgetHelpType)
_CONV_ENUM(Gtk,WindowPosition)
_CONV_ENUM(Gtk,WindowType)
_CONV_ENUM(Gtk,WrapMode)
_CONVERSION(`GtkIconSize',`IconSize',`IconSize(static_cast<int>($3))')
_CONVERSION(`GtkIconSize',`Gtk::IconSize',`Gtk::IconSize(static_cast<int>($3))')
_CONVERSION(`IconSize',`GtkIconSize',`static_cast<GtkIconSize>(int($3))')
_CONVERSION(`Gtk::IconSize',`GtkIconSize',`static_cast<GtkIconSize>(int($3))')
include(convert_atk.m4)
include(convert_pango.m4)
include(convert_gdk.m4)
_CONVERSION(`guint',`WindowType',`static_cast<WindowType>($3)')
_CONVERSION(`PolicyType&',`GtkPolicyType*',`(($2) &($3))')
_CONVERSION(`SortType&',`GtkSortType*',`(($2) &($3))')
_CONVERSION(`SortType*',`GtkSortType*',`(($2) ($3))')
_CONVERSION(`GtkSortType*',`SortType*',`(($2) ($3))')
_CONVERSION(`guint8',`Gtk::StateType',`static_cast<StateType>($3)')
# StockID:
_CONVERSION(`const Gtk::StockID&',`const char*',`($3).get_c_str()')
_CONVERSION(`char*',`StockID',`StockID($3)') # the StockID ctor handles 0
#
# Ptr (gtk+) -> Ptr (gtkmm)
define(`__FP2P',`($`'2)Glib::unwrap($`'3)')
define(`__RP2P',`Glib::wrap($`'3)')
define(`__RP2PD',`Glib::wrap((tran`'slit($`'2,:,))($`'3))')
define(`__RP2CPD',`Glib::wrap((tran`'slit(pat`'subst($`'2,^const ,),:,))($`'3))')
_CONVERSION(`GtkAdjustment*',`Gtk::Adjustment*',__RP2P)
_CONVERSION(`GtkAdjustment*',`Adjustment*',__RP2P)
_CONVERSION(`GtkWidget*',`Gtk::Widget*',__RP2P)
_CONVERSION(`GtkWidget*',`Widget*',__RP2P)
_CONVERSION(`GtkWindow*',`Window*',__RP2P)
_CONVERSION(`GtkMenu*',`Menu*',__RP2P)
# Ptr (gtk+) -> const Ptr (gtkmm)
_CONVERSION(`GtkAdjustment*',`const Gtk::Adjustment*',__RP2P)
_CONVERSION(`GtkAdjustment*',`const Adjustment*',__RP2P)
_CONVERSION(`GtkWidget*',`const Gtk::Widget*',__RP2P)
_CONVERSION(`GtkWidget*',`const Widget*',__RP2P)
_CONVERSION(`GtkWindow*',`const Window*',__RP2P)
# Style:
_CONVERSION(`GtkStyle*',`Glib::RefPtr<Style>',`Glib::wrap($3)')
_CONVERSION(`GtkStyle*',`Glib::RefPtr<const Style>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Style>&',`GtkStyle*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`Glib::RefPtr<Style>',`GtkStyle*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GtkRcStyle*',`Glib::RefPtr<RcStyle>',`Glib::wrap($3)')
_CONVERSION(`GtkRcStyle*',`Glib::RefPtr<const RcStyle>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<RcStyle>&',`GtkRcStyle*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`Glib::RefPtr<RcStyle>',`GtkRcStyle*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GtkRcStyle*',`const Glib::RefPtr<RcStyle>&',`Glib::wrap($3)')
# AccelGroup:
_CONVERSION(`GtkAccelGroup*',`Glib::RefPtr<AccelGroup>',`Glib::wrap($3)')
_CONVERSION(`GtkAccelGroup*',`Glib::RefPtr<const AccelGroup>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<AccelGroup>&',`GtkAccelGroup*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`Gtk::Object&',`GObject*', `($3).Glib::Object::gobj()')
#
# Ptr (Gtkmm) -> Ptr (gtk+)
_CONVERSION(`Gtk::Adjustment*',`GtkAdjustment*',__FP2P)
_CONVERSION(`Adjustment*',`GtkAdjustment*',__FP2P)
_CONVERSION(`Gtk::Widget*',`GtkWidget*',__FP2P)
_CONVERSION(`Widget*',`GtkWidget*',__FP2P)
_CONVERSION(`Menu*',`GtkMenu*',__FP2P)
#
# Ptr (gtk+) -> Ptr (gtkmm) (downcast)
_CONVERSION(`GtkWidget*',`Button*',`Glib::wrap((GtkButton*)($3))')
_CONVERSION(`GtkWidget*',`Box*',`Glib::wrap((GtkBox*)($3))')
_CONVERSION(`GtkWidget*',`HBox*',`Glib::wrap((GtkHBox*)($3))')
_CONVERSION(`GtkWidget*',`VBox*',`Glib::wrap((GtkVBox*)($3))')
_CONVERSION(`GtkWidget*',`ColorSelection*',`Glib::wrap((GtkColorSelection*)($3))')
_CONVERSION(`GtkWidget*',`Gtk::CheckButton*',__RP2PD)
_CONVERSION(`GtkWidget*',`Entry*',`Glib::wrap((GtkEntry*)($3))')
_CONVERSION(`GtkWidget*',`FontSelection*',`Glib::wrap((GtkFontSelection*)($3))')
_CONVERSION(`GtkWidget*',`Label*',`Glib::wrap((GtkLabel*)($3))')
_CONVERSION(`GtkWidget*',`Menu*',`Glib::wrap((GtkMenu*)($3))')
_CONVERSION(`GtkWidget*',`MenuItem*',`Glib::wrap((GtkMenuItem*)($3))')
_CONVERSION(`GtkWidget*',`OptionMenu*',`Glib::wrap((GtkOptionMenu*)($3))')
_CONVERSION(`GtkWidget*',`RadioButton*',`Glib::wrap((GtkRadioButton*)($3))')
_CONVERSION(`GtkWidget*',`Gtk::Scrollbar*',__RP2PD)
_CONVERSION(`GtkWidget*',`Gtk::HScrollbar*',__RP2PD)
_CONVERSION(`GtkWidget*',`Gtk::VScrollbar*',__RP2PD)
_CONVERSION(`GtkWidget*',`Table*',`Glib::wrap((GtkTable*)($3))')
_CONVERSION(`GtkWidget*',`Gtk::Tree*',__RP2PD)
_CONVERSION(`GtkWidget*',`ScrolledWindow*',`Glib::wrap((GtkScrolledWindow*)($3))')
_CONVERSION(`GtkWidget*',`Window*',`Glib::wrap((GtkWindow*)($3))')
_CONVERSION(`GtkWidget*',`TreeView*',`Glib::wrap((GtkTreeView*)($3))')
_CONVERSION(`GtkWidget*',`HButtonBox*',`Glib::wrap((GtkHButtonBox*)($3))')
_CONVERSION(`GtkWidget*',`ComboDropDown*',`Glib::wrap((GtkList*)($3))')
# Ptr (gtk+) -> const Ptr (gtkmm) (downcast)
_CONVERSION(`GtkWidget*',`const Button*',`Glib::wrap((GtkButton*)($3))')
_CONVERSION(`GtkWidget*',`const Box*',`Glib::wrap((GtkBox*)($3))')
_CONVERSION(`GtkWidget*',`const HBox*',`Glib::wrap((GtkHBox*)($3))')
_CONVERSION(`GtkWidget*',`const VBox*',`Glib::wrap((GtkVBox*)($3))')
_CONVERSION(`GtkWidget*',`const ColorSelection*',`Glib::wrap((GtkColorSelection*)($3))')
_CONVERSION(`GtkWidget*',`const Gtk::CheckButton*',__RP2CPD)
_CONVERSION(`GtkWidget*',`const Entry*',`Glib::wrap((GtkEntry*)($3))')
_CONVERSION(`GtkWidget*',`const FontSelection*',`Glib::wrap((GtkFontSelection*)($3))')
_CONVERSION(`GtkWidget*',`const Label*',`Glib::wrap((GtkLabel*)($3))')
_CONVERSION(`GtkWidget*',`const Menu*',`Glib::wrap((GtkMenu*)($3))')
_CONVERSION(`GtkWidget*',`const MenuItem*',`Glib::wrap((GtkMenuItem*)($3))')
_CONVERSION(`GtkWidget*',`const OptionMenu*',`Glib::wrap((GtkOptionMenu*)($3))')
_CONVERSION(`GtkWidget*',`const RadioButton*',`Glib::wrap((GtkRadioButton*)($3))')
_CONVERSION(`GtkWidget*',`const Gtk::Scrollbar*',__RP2CPD)
_CONVERSION(`GtkWidget*',`const Gtk::HScrollbar*',__RP2CPD)
_CONVERSION(`GtkWidget*',`const Gtk::VScrollbar*',__RP2CPD)
_CONVERSION(`GtkWidget*',`const Table*',`Glib::wrap((GtkTable*)($3))')
_CONVERSION(`GtkWidget*',`const Gtk::Tree*',__RP2CPD)
_CONVERSION(`GtkWidget*',`const ScrolledWindow*',`Glib::wrap((GtkScrolledWindow*)($3))')
_CONVERSION(`GtkWidget*',`const Window*',`Glib::wrap((GtkWindow*)($3))')
_CONVERSION(`GtkWidget*',`const TreeView*',`Glib::wrap((GtkTreeView*)($3))')
_CONVERSION(`GtkWidget*',`const HButtonBox*',`Glib::wrap((GtkHButtonBox*)($3))')
_CONVERSION(`GtkWidget*',`const ComboDropDown*',`Glib::wrap((GtkList*)($3))')
# Ptr (gtk+) -> Ref (Gtkmm)
_CONVERSION(`GtkWidget*', `Widget&', `*Glib::wrap($3)')
# Ref (Gtkmm) -> GtkWidget* Ptr (gtk+)
define(`__FR2PD',`($`'3).Gtk::Widget::gobj()')
_CONVERSION(`MenuShell&',`GtkWidget*',__FR2PD)
_CONVERSION(`MenuItem&',`GtkWidget*',__FR2PD)
_CONVERSION(`Menu&',`GtkWidget*',__FR2PD)
_CONVERSION(`Gtk::TreeItem&',`GtkWidget*',__FR2PD)
# Ref (Gtkmm) -> Ptr (gtk+)
define(`__FR2P',`($`'3).gobj()')
define(`__FCR2P',`const_cast<$`'2>(($`'3).gobj())')
_CONVERSION(`Gtk::Adjustment&',`GtkAdjustment*',__FR2P)
_CONVERSION(`Adjustment&',`GtkAdjustment*',__FR2P)
_CONVERSION(`Gtk::Style&',`GtkStyle*',__FR2P)
_CONVERSION(`Gtk::Widget&',`GtkWidget*',__FR2P)
_CONVERSION(`Widget&',`GtkWidget*',__FR2P)
_CONVERSION(`Window&',`GtkWindow*',__FR2P)
_CONVERSION(`CellRenderer&',`GtkCellRenderer*',__FR2P)
# Glib::ListHandle<> (gtkmm) -> GList (gtk+)
_CONVERSION(`const Glib::ListHandle<Glib::ustring>&',`GList*',`$3.data()')
_CONVERSION(`const Glib::ListHandle<Widget*>&',`GList*',`$3.data()')
_CONVERSION(`const Glib::ListHandle<const Widget*>&',`GList*',`$3.data()')
_CONVERSION(`const Glib::ListHandle<Window*>&',`GList*',`$3.data()')
# GList (gtk+) -> Glib::ListHandle<> (gtkmm)
define(`__FL2H_SHALLOW',`$`'2($`'3, Glib::OWNERSHIP_SHALLOW)')
_CONVERSION(`GList*',`Glib::ListHandle<Widget*>',__FL2H_SHALLOW)
_CONVERSION(`GList*',`Glib::ListHandle<const Widget*>',__FL2H_SHALLOW)
_CONVERSION(`GList*',`Glib::ListHandle<Window*>',__FL2H_SHALLOW)
_CONVERSION(`GList*',`Glib::ListHandle<TreeViewColumn*>',__FL2H_SHALLOW)
_CONVERSION(`GList*',`Glib::ListHandle<const TreeViewColumn*>',__FL2H_SHALLOW)
_CONVERSION(`GList*',`Glib::ListHandle<CellRenderer*>',__FL2H_SHALLOW)
_CONVERSION(`GList*',`Glib::ListHandle<const CellRenderer*>',__FL2H_SHALLOW)
_CONVERSION(`GList*',`Glib::ListHandle<TreeModel::Row>',__FL2H_SHALLOW)
_CONVERSION(`GList*',`Glib::ListHandle<const TreeModel::Row>',__FL2H_SHALLOW)
_CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<Tag> >',__FL2H_SHALLOW)
_CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<TextTag> >',__FL2H_SHALLOW)
_CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<TextMark> >',__FL2H_SHALLOW)
_CONVERSION(`GSList*',`Glib::SListHandle< Glib::RefPtr<TextBuffer::Mark> >',__FL2H_SHALLOW)
_CONVERSION(`const Widget&',`GtkWidget*',__FCR2P)
_CONVERSION(`int&',`int*',`&$3',`*$3')
dnl
dnl # These are for fixmegtkconst
_CONVERSION(`gdouble*',`const gdouble*',`const_cast<const gdouble*>($3)',`$3')
_CONVERSION(`const double*',`gdouble*',`const_cast<gdouble*>($3)',`$3')
_CONVERSION(`const guchar*',`guchar*',`const_cast<guchar*>($3)',`$3')
#_CONVERSION(`GSList*',`const Group&',`Group($3)')
_CONVERSION(`GSList*',`Group',`Group($3)')
_CONVERSION(`Group&',`GSList*',`$3.group_')
_CONVERSION(`Group',`GSList*',`$3.group_')
_CONVERSION(`Gtk::Item&',`GtkItem*',__FR2P)
_CONVERSION(Gtk::Notebook_Helpers::Page*,GtkNotebookPage*,`($1)((void*)($3))',`($2)((void*)($3))')
_CONVERSION(`GtkSettings*',`Glib::RefPtr<Settings>', Glib::wrap($3))
_CONVERSION(`IconSet&',`GtkIconSet*',__FR2P)
_CONVERSION(`const IconSet&',`GtkIconSet*',`const_cast<GtkIconSet*>(($3).gobj())')
_CONVERSION(`GtkIconSet*',`IconSet',`Glib::wrap($3)')
_CONVERSION(`IconSource&',`GtkIconSource*',__FR2P)
_CONVERSION(`const IconSource&',`const GtkIconSource*',__FR2P)
_CONVERSION(`const GtkIconSource*',`const IconSource&',`Glib::wrap(const_cast<GtkIconSource*>($3), true)')
# gpointer conversions:
# There's doesn't seem to be a way to tell g_signal_new that it's a pointer to a gint, for instance:
#_CONVERSION(`int*',`gpointer',`($1)$3')
#_CONVERSION(`gpointer',`int*',`($1)$3')
# Text:
_CONVERSION(`GtkTextTagTable*',`Glib::RefPtr<TextTagTable>',`Glib::wrap($3)')
_CONVERSION(`GtkTextTagTable*',`Glib::RefPtr<TagTable>',`Glib::wrap($3)')
_CONVERSION(`GtkTextTagTable*',`Glib::RefPtr<TextBuffer::TagTable>',`Glib::wrap($3)')
_CONVERSION(`GtkTextTagTable*',`Glib::RefPtr<const TextBuffer::TagTable>',`Glib::wrap($3)')
_CONVERSION(`GtkTextMark*',`Glib::RefPtr<Mark>',`Glib::wrap($3)')
_CONVERSION(`GtkTextMark*',`Glib::RefPtr<TextBuffer::Mark>',`Glib::wrap($3)')
_CONVERSION(`GtkTextMark*',`Glib::RefPtr<const TextBuffer::Mark>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Mark>&',`GtkTextMark*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<TextBuffer::Mark>&',`GtkTextMark*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GtkTextTag*',`Glib::RefPtr<TextTag>',`Glib::wrap($3)')
_CONVERSION(`GtkTextTag*',`Glib::RefPtr<const TextTag>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<TextTag>&',`GtkTextTag*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Tag>&',`GtkTextTag*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<TextBuffer::Tag>&',`GtkTextTag*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GtkTextBuffer*',`Glib::RefPtr<TextBuffer>',`Glib::wrap($3)')
_CONVERSION(`GtkTextBuffer*',`Glib::RefPtr<const TextBuffer>',`Glib::wrap($3)')
_CONVERSION(`TextIter&',`GtkTextIter*',__FR2P)
_CONVERSION(`TextBuffer::iterator&',`GtkTextIter*',__FR2P)
_CONVERSION(`iterator&',`GtkTextIter*',__FR2P)
_CONVERSION(`const TextIter&',`const GtkTextIter*',__FR2P)
_CONVERSION(`const TextBuffer::iterator&',`const GtkTextIter*',__FR2P)
_CONVERSION(`const iterator&',`const GtkTextIter*',__FR2P)
_CONVERSION(`TextAttributes&',`GtkTextAttributes*',__FR2P)
_CONVERSION(`GtkTextAttributes*',`TextAttributes',TextAttributes($3))
_CONVERSION(`const Glib::RefPtr<TextTagTable>&',`GtkTextTagTable*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<TextBuffer>&',`GtkTextBuffer*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<TextChildAnchor>&',`GtkTextChildAnchor*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GtkTextChildAnchor*',`Glib::RefPtr<TextChildAnchor>',`Glib::wrap($3)')
# Tree:
_CONVERSION(`const TreeIter&',`const GtkTreeIter*',__FR2P)
_CONVERSION(`const iterator&',`const GtkTreeIter*',__FR2P)
_CONVERSION(`const TreeIter&',`GtkTreeIter*',__FCR2P)
_CONVERSION(`const iterator&',`GtkTreeIter*',__FCR2P)
_CONVERSION(`const TreeModel::Row&',`GtkTreeIter*',__FCR2P)
_CONVERSION(`iterator&',`GtkTreeIter*',__FR2P)
_CONVERSION(`const TreeModel::iterator&',`GtkTreeIter*',__FCR2P)
_CONVERSION(`TreeViewColumn&',`GtkTreeViewColumn*',__FR2P)
_CONVERSION(`GtkTreeViewColumn*',`TreeViewColumn*',`Glib::wrap($3)')
_CONVERSION(`GtkTreeViewColumn*',`const TreeViewColumn*',`Glib::wrap($3)')
_CONVERSION(`TreePath&',`GtkTreePath*',__FR2P)
_CONVERSION(`const TreePath&',`const GtkTreePath*',__FR2P)
_CONVERSION(`const TreePath&',`GtkTreePath*',__FCR2P)
_CONVERSION(`const Path&',`GtkTreePath*',__FCR2P)
_CONVERSION(`const TreeModel::Path&',`GtkTreePath*',__FCR2P)
_CONVERSION(`GtkTreeView*',`TreeView*',`Glib::wrap($3)')
_CONVERSION(`GtkTreeView*',`const TreeView*',`Glib::wrap($3)')
_CONVERSION(`GtkTreeModel*',`Glib::RefPtr<TreeModel>',`Glib::wrap($3)')
_CONVERSION(`GtkTreeModel*',`Glib::RefPtr<const TreeModel>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<TreeModel>&',`GtkTreeModel*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GtkTreeSelection*',`Glib::RefPtr<TreeSelection>',`Glib::wrap($3)')
_CONVERSION(`GtkTreeSelection*',`Glib::RefPtr<const TreeSelection>',`Glib::wrap($3)')
_CONVERSION(`const TreeModelColumnBase&',`int',`($3).index`'()')
_CONVERSION(`GtkTreePath*',`TreePath', `Gtk::TreePath($3, false)')
_CONVERSION(`GtkTreePath*',`Path', `Gtk::TreePath($3, false)')
_CONVERSION(`GtkTreePath*',`TreeModel::Path', `Gtk::TreePath($3, false)')
_CONVERSION(`GtkIconSet*&',`GtkIconSet**',`&($3)')
_CONVERSION(`GtkIconSize&',`GtkIconSize*',`&($3)')
_CONVERSION(`GtkCellEditable*',`CellEditable*',`dynamic_cast<$2>(Glib::wrap_auto((GObject*)($3), false))')
_CONVERSION(`CellEditable*',`GtkCellEditable*',`Glib::unwrap($3)')
#_CONVERSION(`Clipboard&',`GtkClipboard*',`($3).gobj()')
_CONVERSION(`GtkClipboard*',`Glib::RefPtr<Clipboard>',`Glib::wrap($3)')
_CONVERSION(`GtkClipboard*',`Glib::RefPtr<const Clipboard>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Clipboard>&',`GtkClipboard*',__CONVERT_REFPTR_TO_P($3))
#_CONVERSION(`GtkClipboard*',`Gtk::Clipboard&',`Glib::wrap($3, true)')
_CONVERSION(`SelectionData',`GtkSelectionData*', `($3).gobj()')
_CONVERSION(`const SelectionData&',`GtkSelectionData*', __FCR2P)
_CONVERSION(`SelectionData&',`GtkSelectionData*', __FR2P)
#_CONVERSION(`GtkSelectionData*',`SelectionData', `Gtk::SelectionData(($3), true)')
# Used by Signals:
_CONVERSION(`GtkTextIter*',`const TextIter&',Glib::wrap($3))
_CONVERSION(`GtkTextIter*',`const TextBuffer::iterator&',Glib::wrap($3))
_CONVERSION(`const GtkTextIter*',`const TextIter&',Glib::wrap($3))
_CONVERSION(`const GtkTextIter*',`const TextBuffer::iterator&',Glib::wrap($3))
_CONVERSION(`const TextIter&',`GtkTextIter*',__FCR2P)
_CONVERSION(`const TextBuffer::iterator&',`GtkTextIter*',__FCR2P)
_CONVERSION(`GtkTextChildAnchor*',`const Glib::RefPtr<TextChildAnchor>&',`Glib::wrap($3, true)')
_CONVERSION(`GtkTextMark*',`const Glib::RefPtr<Mark>&',`Glib::wrap($3, true)')
_CONVERSION(`GtkTextMark*',`const Glib::RefPtr<TextBuffer::Mark>&',`Glib::wrap($3, true)')
_CONVERSION(`GtkTextTag*',`const Glib::RefPtr<TextTag>&',`Glib::wrap($3, true)')
_CONVERSION(`GtkTextTag*',`const Glib::RefPtr<TextBuffer::Tag>&',`Glib::wrap($3, true)')
_CONVERSION(`GObject*',`const Glib::RefPtr<Glib::Object>&',`Glib::wrap($3, true)')
_CONVERSION(`GtkTreePath*',`const TreeModel::Path&',`Gtk::TreePath($3, true)')
_CONVERSION(`GtkTreePath*',`const Path&',`Gtk::TreePath($3, true)')
_CONVERSION(`TreeViewColumn*',`GtkTreeViewColumn*',__FP2P)
_CONVERSION(`GtkStyle*',`const Glib::RefPtr<Style>&',`Glib::wrap($3, true)')
_CONVERSION(`AlignmentEnum',`float',`_gtkmm_align_float_from_enum($3)')

View file

@ -0,0 +1,8 @@
dnl $Id: convert_gtkmm.m4 2 2003-01-07 16:59:16Z murrayc $
include(convert_base.m4)
include(convert_gtk.m4)
include(convert_pango.m4)
include(convert_gdk.m4)
include(convert_atk.m4)
include(convert_glib.m4)

View file

@ -0,0 +1,137 @@
# Enums:
_CONV_ENUM(Pango,AttrType)
_CONV_ENUM(Pango,Underline)
_CONV_ENUM(Pango,Direction)
_CONV_ENUM(Pango,CoverageLevel)
_CONV_ENUM(Pango,Style)
_CONV_ENUM(Pango,Variant)
_CONV_ENUM(Pango,Stretch)
_CONV_ENUM(Pango,Weight)
_CONV_ENUM(Pango,FontMask)
_CONV_ENUM(Pango,Alignment)
_CONV_ENUM(Pango,WrapMode)
_CONV_ENUM(Pango,TabAlign)
# General conversions:
_CONVERSION(`gchar*',`const char*',`($3)')
_CONVERSION(`guchar*&',`guchar**',`&($3)')
_CONVERSION(`int*&',`int**',`&($3)')
# Wrapper type conversions:
_CONVERSION(`PangoLanguage*',`Language',`Language($3)')
_CONVERSION(`PangoLanguage*',`Pango::Language',`Pango::Language($3)')
_CONVERSION(`const Language&',`const PangoLanguage*',`($3).gobj()')
_CONVERSION(`const Language&',`PangoLanguage*',`const_cast<PangoLanguage*>(`($3).gobj()')')
_CONVERSION(`Rectangle&',`PangoRectangle*',`($3).gobj()')
_CONVERSION(`Rectangle',`PangoRectangle',`*($3).gobj()')
_CONVERSION(`PangoRectangle',`Rectangle',`Rectangle(&($3))')
_CONVERSION(`Color&',`PangoColor*',`($3).gobj()')
_CONVERSION(`const Color&',`const PangoColor*',`($3).gobj()')
_CONVERSION(`Color',`PangoColor',`*($3).gobj()')
_CONVERSION(`PangoColor',`Color',`Color(&($3))')
_CONVERSION(`PangoFontDescription*',`FontDescription',`FontDescription(($3))')
_CONVERSION(`Pango::FontDescription&',`PangoFontDescription*',`($3).gobj()')
_CONVERSION(`FontDescription&',`PangoFontDescription*',`($3).gobj()')
_CONVERSION(`const FontDescription&',`const PangoFontDescription*',`($3).gobj()')
_CONVERSION(`const Pango::FontDescription&',`PangoFontDescription*',`const_cast<PangoFontDescription*>(`($3).gobj()')')
_CONVERSION(`const FontDescription&',`PangoFontDescription*',`const_cast<PangoFontDescription*>(`($3).gobj()')')
_CONVERSION(`PangoFontMetrics*',`FontMetrics',`FontMetrics(($3))')
_CONVERSION(`PangoAttribute*',`Attribute',`Attribute(($3))')
_CONVERSION(`Attribute&',`PangoAttribute*',`($3).gobj()')
_CONVERSION(`const Attribute&',`const PangoAttribute*',`($3).gobj()')
_CONVERSION(`PangoAttrList*',`AttrList',`AttrList(($3))')
_CONVERSION(`PangoAttrList*',`Pango::AttrList',`Pango::AttrList(($3))')
_CONVERSION(`AttrList&',`PangoAttrList*',`($3).gobj()')
_CONVERSION(`Pango::AttrList&',`PangoAttrList*',`($3).gobj()')
_CONVERSION(`PangoAttrIterator*',`AttrIter',`Glib::wrap(($3))')
_CONVERSION(`PangoAnalysis',`Analysis',`Analysis(&($3))')
_CONVERSION(`PangoAnalysis',`const Analysis',`Analysis(&($3))')
_CONVERSION(`Analysis&',`PangoAnalysis*',`($3).gobj()')
_CONVERSION(`const Analysis&',`const PangoAnalysis*',`($3).gobj()')
_CONVERSION(`const Analysis&',`PangoAnalysis*',`const_cast<PangoAnalysis*>(($3).gobj())')
_CONVERSION(`PangoItem*',`Item',`Item(($3))')
_CONVERSION(`PangoItem*',`const Item',`Item(($3))')
_CONVERSION(`Item&',`PangoItem*',`($3).gobj()')
_CONVERSION(`const Item&',`const PangoItem*',`($3).gobj()')
_EQUAL(`PangoGlyph',`Glyph')
_EQUAL(`PangoGlyphUnit',`GlyphUnit')
_EQUAL(`PangoGlyphVisAttr',`GlyphVisAttr')
#_CONVERSION(`PangoGlyphVisAttr',`GlyphVisAttr',`GlyphVisAttr(&($3))')
#_CONVERSION(`GlyphVisAttr',`PangoGlyphVisAttr',`*($3).gobj()')
_CONVERSION(`PangoGlyphGeometry',`GlyphGeometry',`GlyphGeometry(&($3))')
_CONVERSION(`GlyphGeometry',`PangoGlyphGeometry',`*($3).gobj()')
_CONVERSION(`PangoGlyphString*',`GlyphString',`GlyphString(($3))')
_CONVERSION(`PangoGlyphString*',`const GlyphString',`GlyphString(($3))')
_CONVERSION(`PangoFont*',`Glib::RefPtr<Font>',Glib::wrap($3))
_CONVERSION(`PangoFont*',`Glib::RefPtr<Pango::Font>',Glib::wrap($3))
_CONVERSION(`PangoFont*',`Glib::RefPtr<const Font>',Glib::wrap($3))
_CONVERSION(`PangoFont*',`Glib::RefPtr<const Pango::Font>',Glib::wrap($3))
_CONVERSION(`const Glib::RefPtr<Font>&',`PangoFont*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Pango::Font>&',`PangoFont*',__CONVERT_REFPTR_TO_P)
# Special treatment for the Sun Forte compiler
#_CONVERSION(const Glib::RefPtr<const Font>&,`PangoFont*',__CONVERT_CONST_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Font>&',`PangoFont*',__CONVERT_CONST_REFPTR_TO_P_SUN(Font))
#_CONVERSION(`const Glib::RefPtr<const Font>&',`PangoFont*',__CONVERT_CONST_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<const Pango::Font>&',`PangoFont*',__CONVERT_CONST_REFPTR_TO_P_SUN(Pango::Font))
_CONVERSION(`PangoFontMap*',`Glib::RefPtr<FontMap>',Glib::wrap($3))
_CONVERSION(`const Glib::RefPtr<FontMap>&',`PangoFontMap*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`PangoFontSet*',`Glib::RefPtr<FontSet>',Glib::wrap($3))
_CONVERSION(`const Glib::RefPtr<FontSet>&',`PangoFontSet*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`PangoContext*',`Glib::RefPtr<Pango::Context>',Glib::wrap($3))
_CONVERSION(`PangoContext*',`Glib::RefPtr<Context>',Glib::wrap($3))
_CONVERSION(`const Glib::RefPtr<Context>&',`PangoContext*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`PangoLayout*',`Glib::RefPtr<Pango::Layout>',Glib::wrap($3))
_CONVERSION(`PangoLayout*',`Glib::RefPtr<const Pango::Layout>',Glib::wrap($3))
_CONVERSION(`PangoLayout*',`Glib::RefPtr<Layout>',Glib::wrap($3))
_CONVERSION(`PangoLayout*',`const Glib::RefPtr<Pango::Layout>&',Glib::wrap($3))
_CONVERSION(`const Glib::RefPtr<Layout>&',`PangoLayout*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`const Glib::RefPtr<Pango::Layout>&',`PangoLayout*',__CONVERT_REFPTR_TO_P)
# Special treatment for the Sun Forte compiler
_CONVERSION(`const Glib::RefPtr<const Pango::Layout>&',`PangoLayout*',__CONVERT_CONST_REFPTR_TO_P_SUN(Pango::Layout))
_CONVERSION(`const Glib::RefPtr<const Layout>&',`PangoLayout*',__CONVERT_CONST_REFPTR_TO_P_SUN(Layout))
_CONVERSION(`PangoLayoutLine*',`Glib::RefPtr<Pango::LayoutLine>',`Glib::wrap($3)')
_CONVERSION(`PangoLayoutLine*',`Glib::RefPtr<LayoutLine>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Pango::LayoutLine>&',`PangoLayoutLine*',__CONVERT_REFPTR_TO_P)
# Special treatment for the Sun Forte compiler
_CONVERSION(`const Glib::RefPtr<const Pango::LayoutLine>&',`PangoLayoutLine*',__CONVERT_CONST_REFPTR_TO_P_SUN(Pango::LayoutLine))
_CONVERSION(`const Glib::RefPtr<const LayoutLine>&',`PangoLayoutLine*',__CONVERT_CONST_REFPTR_TO_P_SUN(LayoutLine))
_CONVERSION(`PangoLayoutRun*',`LayoutRun',Glib::wrap($3))
_CONVERSION(`PangoLayoutIter*',`LayoutIter',`LayoutIter($3)')
_CONVERSION(`PangoCoverage*',`Glib::RefPtr<Coverage>',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<Coverage>&',`PangoCoverage*',`Glib::unwrap($3)')
_CONVERSION(`PangoTabArray*',`Pango::TabArray',`Pango::TabArray(($3))')
_CONVERSION(`PangoTabArray*',`TabArray',`TabArray(($3))')
_CONVERSION(`Pango::TabArray&',`PangoTabArray*',($3).gobj())
_CONVERSION(`TabArray&',`PangoTabArray*',($3).gobj())
_CONVERSION(`PangoTabAlign&',`PangoTabAlign*',`&$3',`*$3')
_CONVERSION(`Pango::TabAlign&',`PangoTabAlign*',`((PangoTabAlign*) &($3))')
_CONVERSION(`TabAlign&',`PangoTabAlign*',`((PangoTabAlign*) &($3))')
define(`__FL2H_SHALLOW',`$`'2($`'3, Glib::OWNERSHIP_SHALLOW)')
_CONVERSION(`GSList*',`SListHandle_LayoutLine',__FL2H_SHALLOW)

View file

@ -0,0 +1,59 @@
dnl $Id: ctor.m4 376 2007-01-28 22:22:16Z daniel $
dnl
dnl M4 macros for constructor generation.
dnl
dnl Declares and implements the default constructor
dnl
m4_define(`_CTOR_DEFAULT',`dnl
__CPPNAME__`'();
_PUSH(SECTION_CC)
__CPPNAME__::__CPPNAME__`'()
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
__CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()))
{
_IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA)
}
_POP()')
dnl Constructors with property initializations.
dnl
dnl _CTOR_IMPL(cppname, cname, cppargs, c_varargs)
dnl $1 $2 $3 $4
dnl
m4_define(`_CTOR_IMPL',`dnl
_PUSH(SECTION_CC)
__CPPNAME__::$1`'($3)
:
// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
__CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()m4_ifelse(`$4',,,`, $4, static_cast<char*>(0)')))
{
_IMPORT(SECTION_CC_INITIALIZE_CLASS_EXTRA)
}
_POP()')
m4_define(`_CONSTRUCT',
`// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
__CPPPARENT__`'(Glib::ConstructParams(__BASE__`'_class_.init()m4_ifelse(`$1',,,`, $@, static_cast<char*>(0)')))')
dnl _CONSTRUCT() does not deal with multiple class definitions in one file.
dnl If necessary, _CONSTRUCT_SPECIFIC(BaseClass, Class) must be used instead.
dnl
m4_define(`_CONSTRUCT_SPECIFIC',
`// Mark this class as non-derived to allow C++ vfuncs to be skipped.
Glib::ObjectBase(0),
$1`'(Glib::ConstructParams(_LOWER(`$2')_class_.init()m4_ifelse(`$3',,,`, m4_shift(m4_shift($@)), static_cast<char*>(0)')))')
dnl Extra code for initialize_class.
dnl Not commonly used.
dnl
m4_define(`_INITIALIZE_CLASS_EXTRA',`dnl
_PUSH(SECTION_CC_INITIALIZE_CLASS_EXTRA)
$1
_POP()')

View file

@ -0,0 +1,3 @@
dnl $Id: doc.m4 2 2003-01-07 16:59:16Z murrayc $
divert(-1)

View file

@ -0,0 +1,101 @@
dnl
dnl _ENUM(cpp_type, c_type, value_suffix, `element_list', `flags', `optional_refdoc_comment', 'get_type_function_name')
dnl
m4_define(`_ENUM',`dnl
_PUSH()
m4_define(`__ENUM_CPPNAME__',`$1')
m4_define(`__ENUM_CNAME__',`$2')
m4_define(`__ENUM_VALUE_BASE__',`Glib::Value_$3<__NAMESPACE__::__ENUM_CPPNAME__>')
_POP()
dnl
dnl // Define a new Doxygen group if this is the first enum in the file.
dnl
m4_ifdef(`__DOCGROUP_'__MODULE_CANONICAL__`_ENUMS__',,`dnl else
m4_define(`__DOCGROUP_'__MODULE_CANONICAL__`_ENUMS__')dnl
/** @addtogroup '__MODULE_CANONICAL__`Enums Enums and Flags */
')dnl endif
dnl
dnl
/**$6
* @ingroup __MODULE_CANONICAL__`'Enums
m4_ifelse($3,Flags,`dnl
* @par Bitwise operators:
* <tt>%__ENUM_CPPNAME__ operator|(__ENUM_CPPNAME__, __ENUM_CPPNAME__)</tt><br>
* <tt>%__ENUM_CPPNAME__ operator&(__ENUM_CPPNAME__, __ENUM_CPPNAME__)</tt><br>
* <tt>%__ENUM_CPPNAME__ operator^(__ENUM_CPPNAME__, __ENUM_CPPNAME__)</tt><br>
* <tt>%__ENUM_CPPNAME__ operator~(__ENUM_CPPNAME__)</tt><br>
* <tt>%__ENUM_CPPNAME__& operator|=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)</tt><br>
* <tt>%__ENUM_CPPNAME__& operator&=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)</tt><br>
* <tt>%__ENUM_CPPNAME__& operator^=(__ENUM_CPPNAME__&, __ENUM_CPPNAME__)</tt><br>
')dnl endif
*/
enum __ENUM_CPPNAME__
{
$4
};
m4_ifelse($3,Flags,`dnl
/** @ingroup __MODULE_CANONICAL__`'Enums */
inline __ENUM_CPPNAME__ operator|(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs)
{ return static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
/** @ingroup __MODULE_CANONICAL__`'Enums */
inline __ENUM_CPPNAME__ operator&(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs)
{ return static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
/** @ingroup __MODULE_CANONICAL__`'Enums */
inline __ENUM_CPPNAME__ operator^(__ENUM_CPPNAME__ lhs, __ENUM_CPPNAME__ rhs)
{ return static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
/** @ingroup __MODULE_CANONICAL__`'Enums */
inline __ENUM_CPPNAME__ operator~(__ENUM_CPPNAME__ flags)
{ return static_cast<__ENUM_CPPNAME__>(~static_cast<unsigned>(flags)); }
/** @ingroup __MODULE_CANONICAL__`'Enums */
inline __ENUM_CPPNAME__& operator|=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs)
{ return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
/** @ingroup __MODULE_CANONICAL__`'Enums */
inline __ENUM_CPPNAME__& operator&=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs)
{ return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
/** @ingroup __MODULE_CANONICAL__`'Enums */
inline __ENUM_CPPNAME__& operator^=(__ENUM_CPPNAME__& lhs, __ENUM_CPPNAME__ rhs)
{ return (lhs = static_cast<__ENUM_CPPNAME__>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
')dnl endif Flags
m4_ifelse($5,`NO_GTYPE',,`dnl else
__NAMESPACE_END__
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<__NAMESPACE__::__ENUM_CPPNAME__> : public __ENUM_VALUE_BASE__
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
__NAMESPACE_BEGIN__
_PUSH(SECTION_SRC_GENERATED)
// static
GType Glib::Value<__NAMESPACE__::__ENUM_CPPNAME__>::value_type()
{
return _GET_TYPE_FUNC(__ENUM_CNAME__);
}
_POP()
')dnl endif !NO_GTYPE
')dnl enddef _ENUM

View file

@ -0,0 +1,102 @@
dnl $Id: gerror.m4 291 2006-05-12 08:08:45Z murrayc $
dnl
dnl _GERROR(PixbufError,GdkPixbufError,GDK_PIXBUF_ERROR,`<enum_value_list>',[NO_GTYPE])
dnl
m4_define(`_GERROR',`dnl
_PUSH()
dnl
dnl Define the args for later macros
m4_define(`__CPPNAME__',`$1')
m4_define(`__CNAME__',`$2')
m4_define(`__CQUARK__',`$3')
m4_define(`__VALUE_BASE__',`Glib::Value_Enum<__NAMESPACE__::__CPPNAME__::Code>')
_POP()
class __CPPNAME__ : public Glib::Error
{
public:
enum Code
{
$4
};
__CPPNAME__`'(Code error_code, const Glib::ustring& error_message);
explicit __CPPNAME__`'(GError* gobject);
Code code() const;
#ifndef DOXYGEN_SHOULD_SKIP_THIS
private:
#ifdef GLIBMM_EXCEPTIONS_ENABLED
static void throw_func(GError* gobject);
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
static std::auto_ptr<Glib::Error> throw_func(GError* gobject);
#endif //GLIBMM_EXCEPTIONS_ENABLED
friend void wrap_init(); // uses throw_func()
#endif
};
m4_ifelse($5,`NO_GTYPE',,`dnl else
__NAMESPACE_END__
#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Glib
{
template <>
class Value<__NAMESPACE__::__CPPNAME__::Code> : public __VALUE_BASE__
{
public:
static GType value_type() G_GNUC_CONST;
};
} // namespace Glib
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
__NAMESPACE_BEGIN__
')dnl endif !NO_GTYPE
_PUSH(SECTION_SRC_GENERATED)
__NAMESPACE__::__CPPNAME__::__CPPNAME__`'(__NAMESPACE__::__CPPNAME__::Code error_code, const Glib::ustring& error_message)
:
Glib::Error (__CQUARK__, error_code, error_message)
{}
__NAMESPACE__::__CPPNAME__::__CPPNAME__`'(GError* gobject)
:
Glib::Error (gobject)
{}
__NAMESPACE__::__CPPNAME__::Code __NAMESPACE__::__CPPNAME__::code() const
{
return static_cast<Code>(Glib::Error::code());
}
#ifdef GLIBMM_EXCEPTIONS_ENABLED
void __NAMESPACE__::__CPPNAME__::throw_func(GError* gobject)
{
throw __NAMESPACE__::__CPPNAME__`'(gobject);
}
#else
//When not using exceptions, we just pass the Exception object around without throwing it:
std::auto_ptr<Glib::Error> __NAMESPACE__::__CPPNAME__::throw_func(GError* gobject)
{
return std::auto_ptr<Glib::Error>(new __NAMESPACE__::__CPPNAME__`'(gobject));
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
m4_ifelse($5,`NO_GTYPE',,`dnl else
// static
GType Glib::Value<__NAMESPACE__::__CPPNAME__::Code>::value_type()
{
return _GET_TYPE_FUNC(__CNAME__);
}
')dnl endif !NO_GTYPE
_POP()
') dnl enddef _GERROR

View file

@ -0,0 +1,230 @@
_PUSH()
dnl
dnl These variables affect the generation of the list
dnl
define(GP_LIST_HELPER_NAMESPACE,`define(`__LIST_NAMESPACE__',$1)')
define(GP_LIST_ELEM,`define(`__LISTELEM__',`$*')')
define(GP_LIST_ITER,`define(`__LISTITER__',`$*')')
define(GP_LIST_NOINSERT,`define(`__LISTEO__')')
dnl
dnl GP_LIST(ListName, ParentCppType, ParentCType, ChildCppType, FieldNameC)
dnl
dnl In the .ccg file, you'll need to implement:
dnl iterator insert(iterator position, element_type& e);
dnl
dnl Fieldname assumed to be children if not specified
define(GP_LIST,`
_PUSH()
define(`__LISTNAME__',$1)
define(`__LISTPARENT__',$2)
define(`__LISTPARENT_G__',$3)
define(`__LISTTYPE__',$4)
define(`__LISTELEM__',const Element)
define(`__LISTITER__',Glib::List_Iterator< __LISTTYPE__ >)
define(`__LIST_NAMESPACE__',$2_Helpers)
#define(`__LISTFIELD__',ifelse($5,,children,$5))
define(`__LISTFIELD__',$5)
_SECTION(SECTION_USR)
')
dnl
dnl GP_LIST_END()
dnl
dnl Closes a list
define(GP_LIST_END,`dnl
_POP()
class __LISTNAME__ : public Glib::HelperList< __LISTTYPE__, __LISTELEM__, __LISTITER__ >
{
public:
__LISTNAME__`'();
explicit __LISTNAME__`'(__LISTPARENT_G__* gparent);
__LISTNAME__`'(const __LISTNAME__& src);
virtual ~__LISTNAME__`'() {}
__LISTNAME__& operator=(const __LISTNAME__& src);
typedef Glib::HelperList< __LISTTYPE__, __LISTELEM__, __LISTITER__ > type_base;
__LISTPARENT_G__* gparent();
const __LISTPARENT_G__* gparent() const;
virtual GList*& glist() const; // front of list
virtual void erase(iterator start, iterator stop);
virtual iterator erase(iterator); //Implented as custom or by LIST_CONTAINER_REMOVE
virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE
/// This is order n. (use at own risk)
reference operator[](size_type l) const;
ifdef(`__LISTEO__',`dnl
protected:
//Hide these because it's read-only:
iterator insert(iterator position, element_type& e);
inline void pop_front();
inline void pop_back();
,`dnl
public:
iterator insert(iterator position, element_type& e); //custom-implemented.
template <class InputIterator>
inline void insert(iterator position, InputIterator first, InputIterator last)
{
for(;first != last; ++first)
position = insert(position, *first);
}
inline void push_front(element_type& e)
{ insert(begin(), e); }
inline void push_back(element_type& e)
{ insert(end(), e); }
')dnl
_IMPORT(SECTION_USR)
};
_PUSH(SECTION_CC)
namespace __LIST_NAMESPACE__
{
__LISTNAME__::__LISTNAME__`'()
{}
__LISTNAME__::__LISTNAME__`'(__LISTPARENT_G__* gparent)
: type_base((GObject*)gparent)
{}
__LISTNAME__::__LISTNAME__`'(const __LISTNAME__& src)
:
type_base(src)
{}
__LISTNAME__& __LISTNAME__::operator=(const __LISTNAME__& src)
{
type_base::operator=(src);
return *this;
}
ifelse(__LISTFIELD__,CUSTOM,`dnl
',`dnl else
GList*& __LISTNAME__::glist() const
{
return ((__LISTPARENT_G__*)gparent_)->__LISTFIELD__;
}
')dnl endif
void __LISTNAME__::erase(iterator start, iterator stop)
{
type_base::erase(start, stop);
}
__LISTPARENT_G__* __LISTNAME__::gparent()
{
return (__LISTPARENT_G__*)type_base::gparent();
}
const __LISTPARENT_G__* __LISTNAME__::gparent() const
{
return (__LISTPARENT_G__*)type_base::gparent();
}
__LISTNAME__::reference __LISTNAME__::operator[](size_type l) const
{
return type_base::operator[](l);
}
} /* namespace __LIST_NAMESPACE__ */
undefine(`__LISTNAME__')dnl
undefine(`__LISTTYPE__')dnl
undefine(`__LISTPARENT__')dnl
undefine(`__LISTELEM__')dnl
undefine(`__LISTFIELD__')dnl
_POP()
')
dnl
dnl GP_LIST_FIND(access_method)
dnl
dnl Defines find(containertype) and find(Widget&)
dnl access_method is the name of method returning a Widget*
define(GP_LIST_FIND,`
iterator find(const_reference c);
iterator find(Widget&);
_PUSH(SECTION_CC)
namespace __LIST_NAMESPACE__
{
__LISTNAME__::iterator __LISTNAME__::find(const_reference w)
{
iterator i = begin();
for(i = begin(); i != end() && (i->ifelse($1,,,$1()->)gobj() != w.ifelse($1,,,$1()->)gobj()); i++);
return i;
}
__LISTNAME__::iterator __LISTNAME__::find(Widget& w)
{
iterator i;
for(i = begin(); i != end() && ((GtkWidget*)i->ifelse($1,,,$1()->)gobj() != w.gobj()); i++);
return i;
}
} /* namespace __LIST_NAMESPACE__ */
_POP()
')
dnl
dnl GP_LIST_CONTAINER_REMOVE(access_method)
dnl
dnl Implements remove(const_reference), erase(iterator)
dnl and defines remove(Widget&)
dnl (assumes that the widget uses gtk+ container methods).
dnl access_method is the name of the method returning a Widget*
define(GP_LIST_CONTAINER_REMOVE,`
virtual void remove(Widget& w); //Implented as custom or by LIST_CONTAINER_REMOVE
_PUSH(SECTION_CC)
namespace __LIST_NAMESPACE__
{
void __LISTNAME__::remove(const_reference child)
{
gtk_container_remove(GTK_CONTAINER(gparent_),
(GtkWidget*)(child.ifelse($1,,,$1()->)gobj()));
}
void __LISTNAME__::remove(Widget& widget)
{
gtk_container_remove(GTK_CONTAINER(gparent_), (GtkWidget*)(widget.gobj()));
}
__LISTNAME__::iterator __LISTNAME__::erase(iterator position)
{
//Check that it is a valid iterator, to a real item:
if ( !position.node_|| (position == end()) )
return end();
//Get an iterator the the next item, to return:
iterator next = position;
next++;
//Use GTK+ C function to remove it, by providing the GtkWidget*:
gtk_container_remove( GTK_CONTAINER(gparent_), (GtkWidget*)(position->ifelse($1,,,$1()->)gobj()) );
return next;
}
} /* namespace __LIST_NAMESPACE__ */
_POP()
')
_POP()dnl

View file

@ -0,0 +1,132 @@
dnl
dnl --------------------------- Accessors ----------------------------
dnl
dnl Get:
dnl Creates accessors for simple types:
dnl _MEMBER_GET(cpp_name, c_name, cpp_type, c_type, deprecated (optional))
define(`_MEMBER_GET',`dnl
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
$3 get_$1() const;
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_PUSH(SECTION_CC)
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
$3 __CPPNAME__::get_$1() const
{
return _CONVERT($4,$3,`gobj()->$2');
}
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_POP()')
dnl Creates two accessors for pointer types, one const and one non-const:
define(`_MEMBER_GET_PTR',`dnl
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
$3 get_$1();
const $3 get_$1() const;
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_PUSH(SECTION_CC)
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
$3 __CPPNAME__::get_$1()
{
return _CONVERT($4,$3,`gobj()->$2');
}
const $3 __CPPNAME__::get_$1() const
{
return _CONVERT($4,const $3,`gobj()->$2');
}
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_POP()')
dnl Creates accessors for GObject-derived types that must be ref()ed.
define(`_MEMBER_GET_GOBJECT',`dnl
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
Glib::RefPtr<$3> get_$1();
Glib::RefPtr<const $3> get_$1() const;
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_PUSH(SECTION_CC)
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
Glib::RefPtr<$3> __CPPNAME__::get_$1()
{
Glib::RefPtr<$3> ref_ptr(_CONVERT($4,Glib::RefPtr<$3>,`gobj()->$2'));
dnl We could use the bool with Glib::wrap(), but we want to share the m4 type-conversion map.
if(ref_ptr)
ref_ptr->reference();
return ref_ptr;
}
Glib::RefPtr<const $3> __CPPNAME__::get_$1() const
{
Glib::RefPtr<const $3> ref_ptr(_CONVERT($4,Glib::RefPtr<const $3>,`gobj()->$2'));
dnl We could use the bool with Glib::wrap(), but we want to share the m4 type-conversion map.
if(ref_ptr)
ref_ptr->reference();
return ref_ptr;
}
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_POP()')
dnl Set:
dnl Creates accessors for simple types:
define(`_MEMBER_SET',`dnl
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
void set_$1(const $3`'& value);
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_PUSH(SECTION_CC)
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
void __CPPNAME__::set_$1(const $3`'& value)
{
gobj()->$2 = _CONVERT($3,$4,`value');
}
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_POP()')
dnl Creates accessors for pointer types:
define(`_MEMBER_SET_PTR',`dnl
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
void set_$1($3 value);
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_PUSH(SECTION_CC)
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
void __CPPNAME__::set_$1($3 value)
{
gobj()->$2 = _CONVERT($3,$4,`value');
}
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_POP()')
dnl Creates accessors for GObject-derived types that must be ref()ed.
define(`_MEMBER_SET_GOBJECT',`dnl
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
void set_$1(const Glib::RefPtr<$3>& value);
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_PUSH(SECTION_CC)
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_START ') dnl
void __CPPNAME__::set_$1(const Glib::RefPtr<$3>& value)
{
Glib::RefPtr<$3> valueOld(_CONVERT($4,Glib::RefPtr<$3>,`gobj()->$2')); //Take possession of the old one, unref-ing it in the destructor.
if(value)
value->reference(); //Ref once for the recipient.
gobj()->$2 = _CONVERT(const Glib::RefPtr<$3>&,$4,`value');
}
ifelse(`$5',`deprecated',`_DEPRECATE_IFDEF_END ') dnl
_POP()')

View file

@ -0,0 +1,108 @@
dnl $Id: method.m4 320 2006-09-19 20:07:31Z murrayc $
dnl
dnl
dnl Code generation sections for making a method.
dnl
dnl
dnl
dnl method
dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 $11 $12 $13 $14
dnl _METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,const,refreturn,errthrow,deprecated,constversion,ifdef, arglist_without_types)
define(`_METHOD',`dnl
_PUSH(SECTION_CC)
ifelse(`$10',,,`_DEPRECATE_IFDEF_START
')dnl
ifelse(`$13',,,`#ifdef $13'
)dnl
ifelse(`$9',,,`#ifdef GLIBMM_EXCEPTIONS_ENABLED'
)dnl
$3 __CPPNAME__::$1`'($5)ifelse(`$7',1,` const')
ifelse(`$9',,,`#else
$3 __CPPNAME__::$1`'(`'$5`'ifelse(($5),(),`',`, ')std::auto_ptr<Glib::Error>& error)ifelse(`$7',1,` const')
#endif //GLIBMM_EXCEPTIONS_ENABLED
')dnl
{
ifelse(`$11',,dnl
`ifelse(`$8'`$9',,dnl If it is not errthrow or refreturn
`ifelse(`$3',void,dnl If it returns voids:
`$2(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6);' dnl It it returns non-void:
,` return _CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');')'dnl End if it returns voids.
,dnl If is errthrow or refreturn
`ifelse(`$9',,,` GError* gerror = 0;')
ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,$3,`$2`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'ifelse(`$6',,,`, ')$6)');dnl
ifelse(`$9',,,`
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
')
ifelse(`$8',,,`dnl
if(retvalue)
retvalue->reference(); //The function does not do a ref for us.
')dnl
ifelse(`$3',void,,` return retvalue;')
')dnl End errthrow/refreturn
',` return const_cast<__CPPNAME__*>(this)->$1($12);')
}
ifelse(`$13',,,`
#endif // $13
')dnl
ifelse(`$10',,,`_DEPRECATE_IFDEF_END
')dnl
_POP()')
dnl
dnl static method
dnl $1 $2 $3 $4 $5 $6 $7 $8 $9 $10
dnl _STATIC_METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,refreturn,errthrow,deprecated,ifdef))
define(`_STATIC_METHOD',`dnl
_PUSH(SECTION_CC)
ifelse(`$9',,,`_DEPRECATE_IFDEF_START
')dnl
ifelse(`$10',,,`#ifdef $10'
)dnl
ifelse(`$8',,,`#ifdef GLIBMM_EXCEPTIONS_ENABLED
')dnl
$3 __CPPNAME__::$1($5)
ifelse(`$8',,,`#else
$3 __CPPNAME__::$1(`'$5`'ifelse(($5),(),`',`, ')std::auto_ptr<Glib::Error>& error)
#endif //GLIBMM_EXCEPTIONS_ENABLED
')dnl
{
ifelse(`$7'`$8',,dnl
`ifelse(`$3',void,,` return ')_CONVERT($4,$3,`$2`'($6)');
',dnl
`ifelse(`$8',,,` GError* gerror = 0;')
ifelse(`$3',void,,``$3' retvalue = ')_CONVERT($4,$3,`$2`'($6)');
ifelse(`$8',,,`
#ifdef GLIBMM_EXCEPTIONS_ENABLED
if(gerror)
::Glib::Error::throw_exception(gerror);
#else
if(gerror)
error = ::Glib::Error::throw_exception(gerror);
#endif //GLIBMM_EXCEPTIONS_ENABLED
')
ifelse(`$7',,,`dnl
if(retvalue)
retvalue->reference(); //The function does not do a ref for us.
')dnl
ifelse(`$3',void,,` return retvalue;')
')dnl
}
ifelse(`$10',,,`
#endif // $10
')dnl
ifelse(`$9',,,`_DEPRECATE_IFDEF_END
')
_POP()')

View file

@ -0,0 +1,40 @@
dnl $Id: property.m4 291 2006-05-12 08:08:45Z murrayc $
dnl
dnl
dnl Code generation sections for properties
dnl
dnl
dnl
dnl _PROPERTY_PROXY(name, name_underscored, cpp_type, proxy_suffix, docs)
dnl proxy_suffix could be "_WriteOnly" or "_ReadOnly"
dnl The method will be const if the propertyproxy is _ReadOnly.
dnl
define(`_PROPERTY_PROXY',`dnl
dnl
dnl Put spaces around the template parameter if necessary.
pushdef(`__PROXY_TYPE__',`dnl
Glib::PropertyProxy$4<'ifelse(regexp(_QUOTE($3),`>$'),`-1',_QUOTE($3),` '_QUOTE($3)` ')`>'dnl
)dnl
#ifdef GLIBMM_PROPERTIES_ENABLED
/** $5
*
* You rarely need to use properties because there are get_ and set_ methods for almost all of them.
* @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
* the value of the property changes.
*/
__PROXY_TYPE__ property_$2`'() ifelse($4,_ReadOnly, const,);
#endif //#GLIBMM_PROPERTIES_ENABLED
_PUSH(SECTION_CC_PROPERTYPROXIES)
#ifdef GLIBMM_PROPERTIES_ENABLED
__PROXY_TYPE__ __CPPNAME__::property_$2`'() ifelse($4,_ReadOnly, const,)
{
return __PROXY_TYPE__`'(this, "$1");
}
#endif //GLIBMM_PROPERTIES_ENABLED
_POP()
popdef(`__PROXY_TYPE__')dnl
')dnl

View file

@ -0,0 +1,272 @@
#
# --------------------------- Signal Decl----------------------------
#
dnl _SIGNAL_PROXY($1 = c_signal_name,
dnl $2 = c_return_type,
dnl $3 = `<c_arg_types_and_names>',
dnl $4 = cpp_signal_name,
dnl $5 = cpp_return_type,
dnl $6 = `<cpp_arg_types>',
dnl $7 = `<c_args_to_cpp>',
dnl $8 = `custom_c_callback (boolean)',
dnl $9 = `refdoc_comment',
dnl $10 = ifdef)
define(`_SIGNAL_PROXY',`
$9
ifelse(`$10',,,`#ifdef $10'
)dnl
Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) > signal_$4`'();
ifelse(`$10',,,`#endif // $10
')dnl
dnl
_PUSH(SECTION_ANONYMOUS_NAMESPACE)
ifelse(`$10',,,`#ifdef $10'
)dnl
dnl
ifelse($2`'_NUM($3)`'$5`'_NUM($6),`void0void0',`dnl
dnl
dnl Use predefined callback for SignalProxy0<void>, to reduce code size.
static const Glib::SignalProxyInfo __CPPNAME__`'_signal_$4_info =
{
"$1",
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback,
(GCallback) &Glib::SignalProxyNormal::slot0_void_callback
};
',`dnl else
ifelse($8,`1',,`dnl Do not generate the implementation if it should be custom:
static $2 __CPPNAME__`'_signal_$4_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3)`'void* data)
{
using namespace __NAMESPACE__;
typedef sigc::slot< $5`'_COMMA_PREFIX($6) > SlotType;
// Do not try to call a signal on a disassociated wrapper.
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot`'(data))
ifelse(`$2',void,`dnl
(*static_cast<SlotType*>(slot))($7);
',`dnl else
return _CONVERT($5,$2,`(*static_cast<SlotType*>(slot))($7)');
')dnl endif
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
ifelse($2,void,,`dnl else
typedef $2 RType;
return RType`'();
')dnl
}
ifelse($2,void,,`dnl else
static $2 __CPPNAME__`'_signal_$4_notify_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3)`' void* data)
{
using namespace __NAMESPACE__;
typedef sigc::slot< void`'_COMMA_PREFIX($6) > SlotType;
// Do not try to call a signal on a disassociated wrapper.
if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot`'(data))
(*static_cast<SlotType*>(slot))($7);
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
typedef $2 RType;
return RType`'();
}
')dnl endif
')dnl endif
static const Glib::SignalProxyInfo __CPPNAME__`'_signal_$4_info =
{
"$1",
(GCallback) &__CPPNAME__`'_signal_$4_callback,
(GCallback) &__CPPNAME__`'_signal_$4_`'ifelse($2,void,,notify_)`'callback
};
')dnl endif
ifelse(`$10',,,`#endif // $10
')dnl
_SECTION(SECTION_CC_SIGNALPROXIES)
ifelse(`$10',,,`#ifdef $10'
)dnl
Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) > __CPPNAME__::signal_$4`'()
{
return Glib::SignalProxy`'_NUM($6)< $5`'_COMMA_PREFIX($6) >(this, &__CPPNAME__`'_signal_$4_info);
}
ifelse(`$10',,,`#endif // $10
')dnl
_POP()')
dnl
dnl _SIGNAL_PH(gname, crettype, cargs and names)
dnl Create a callback and set it in our derived G*Class.
dnl
define(`_SIGNAL_PH',`dnl
_PUSH(SECTION_PCC_CLASS_INIT_DEFAULT_SIGNAL_HANDLERS)
ifelse(`$4',,,`#ifdef $4'
)dnl
klass->$1 = `&'$1_callback;
ifelse(`$4',,,`#endif // $4
')dnl
_SECTION(SECTION_PH_DEFAULT_SIGNAL_HANDLERS)
ifelse(`$4',,,`#ifdef $4'
)dnl
static $2 $1_callback`'($3);
ifelse(`$4',,,`#endif // $4
')dnl
_POP()')
dnl $1 $2 $3 $4
dnl _SIGNAL_PCC(cppname,gname,cpprettype,crettype,
dnl $5 $6 $7 $8 $9
dnl `<cargs and names>',`<cnames>',`<cpparg names>', firstarg, <ifndef>)
dnl
define(`_SIGNAL_PCC',`dnl
_PUSH(SECTION_PCC_DEFAULT_SIGNAL_HANDLERS)
ifelse(`$9',,,`#ifdef $9'
)dnl
$4 __CPPNAME__`'_Class::$2_callback`'($5)
{
dnl First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
dnl eventually, but it is not necessary to check whether we need to call
dnl the vfunc.
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
_IMPORT(SECTION_CHECK)
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
dnl We need to do a dynamic cast to get the real object type, to call the
dnl C++ vfunc on it.
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
ifelse($4,void,`dnl
obj->on_$1`'($7);
return;
',`dnl
return _CONVERT($3,$4,`obj->on_$1`'($7)');
')dnl
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke`'();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT($8)dnl
',`dnl
_PARENT_GCLASS_FROM_OBJECT($8)dnl
') );
dnl g_assert(base != 0);
// Call the original underlying C function:
if(base && base->$2)
ifelse($4,void,,`return ')(*base->$2)`'($6);
ifelse($4,void,,`dnl
typedef $4 RType;
return RType`'();
')dnl
}
ifelse(`$9',,,`#endif // $9
')dnl
_POP()')
dnl $1 $2 $3 $4
dnl _SIGNAL_H(signame, rettype, `<cppargs>', <ifdef>)
dnl
define(`_SIGNAL_H',`dnl
_PUSH(SECTION_H_DEFAULT_SIGNAL_HANDLERS)
ifelse(`$4',,,`#ifdef $4'
)dnl
virtual $2 on_$1`'($3);
ifelse(`$4',,,`#endif // $4
')dnl
_POP()')
dnl $1 $2 $3 $4 $5 $6 $7 $8 $9
dnl _SIGNAL_CC(signame,gname,rettype,crettype,`<cppargs>',`<carg_names>', const, refreturn, <ifdef>)
dnl
define(`_SIGNAL_CC',`dnl
_PUSH(SECTION_CC_DEFAULT_SIGNAL_HANDLERS)
ifelse(`$9',,,`#ifdef $9'
)dnl
$3 __NAMESPACE__::__CPPNAME__::on_$1`'($5)
{
BaseClassType *const base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT(gobject_)dnl
',`dnl
_PARENT_GCLASS_FROM_OBJECT(gobject_)dnl
') );
dnl g_assert(base != 0);
if(base && base->$2)
ifelse($3,void,`dnl
(*base->$2)`'(gobj`'()`'_COMMA_PREFIX($6));
',`dnl
ifelse($8,refreturn,`dnl Assume Glib::wrap() is correct if refreturn is requested.
return Glib::wrap((*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6)), true);
',`dnl
return _CONVERT($4,$3,`(*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6))');
')dnl
typedef $3 RType;
return RType`'();
')dnl
}
ifelse(`$9',,,`#endif // $9
')dnl
_POP()')

View file

@ -0,0 +1,154 @@
dnl
dnl _VFUNC_PH(gtkname, crettype, cargs and names)
dnl Create a callback and set it in our derived G*Class.
dnl
define(`_VFUNC_PH',`dnl
_PUSH(SECTION_PCC_CLASS_INIT_VFUNCS)
ifelse(`$4',,,`#ifdef $4'
)dnl
klass->$1 = `&'$1_vfunc_callback;
ifelse(`$4',,,`#endif // $4
')dnl
_SECTION(SECTION_PH_VFUNCS)
ifelse(`$4',,,`#ifdef $4'
)dnl
static $2 $1_vfunc_callback`'($3);
ifelse(`$4',,,`#endif // $4
')dnl
_POP()')
dnl $1 $2 $3 $4
dnl _VFUNC_PCC(cppname,gtkname,cpprettype,crettype,
dnl $5 $6 $7 $8 $9 $10
dnl `<cargs and names>',`<cnames>',`<cpparg names>',firstarg, refreturn_ctype, ifdef)
dnl
dnl Note: _get_current_wrapper_inline() could be used throughout for performance instead of _get_current_wrapper(),
dnl and is_derived_() instead of is_derived_(),
dnl but it is not yet clear whether that would be a worthwhile performance optimization.
define(`_VFUNC_PCC',`dnl
_PUSH(SECTION_PCC_VFUNCS)
ifelse(`$10',,,`#ifdef $10'
)dnl
$4 __CPPNAME__`'_Class::$2_vfunc_callback`'($5)
{
dnl First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
dnl eventually, but it is not necessary to check whether we need to call
dnl the vfunc.
Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
_IMPORT(SECTION_CHECK)
// Non-gtkmmproc-generated custom classes implicitly call the default
// Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
// generated classes can use this optimisation, which avoids the unnecessary
// parameter conversions if there is no possibility of the virtual function
// being overridden:
if(obj_base && obj_base->is_derived_())
{
dnl We need to do a dynamic cast to get the real object type, to call the
dnl C++ vfunc on it.
CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
if(obj) // This can be NULL during destruction.
{
#ifdef GLIBMM_EXCEPTIONS_ENABLED
try // Trap C++ exceptions which would normally be lost because this is a C callback.
{
#endif //GLIBMM_EXCEPTIONS_ENABLED
// Call the virtual member method, which derived classes might override.
ifelse($4,void,`dnl
obj->$1`'($7);
return;
',`dnl
ifelse($9,refreturn_ctype,`dnl Assume Glib::unwrap_copy() is correct if refreturn_ctype is requested.
return Glib::unwrap_copy`'(`obj->$1'($7));
',`dnl
return _CONVERT($3,$4,`obj->$1`'($7)');
')dnl
')dnl
#ifdef GLIBMM_EXCEPTIONS_ENABLED
}
catch(...)
{
Glib::exception_handlers_invoke`'();
}
#endif //GLIBMM_EXCEPTIONS_ENABLED
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT($8)dnl
',`dnl
_PARENT_GCLASS_FROM_OBJECT($8)dnl
') );
dnl g_assert(base != 0);
// Call the original underlying C function:
if(base && base->$2)
ifelse($4,void,,`return ')(*base->$2)`'($6);
ifelse($4,void,,`dnl
typedef $4 RType;
return RType`'();
')dnl
}
ifelse(`$10',,,`#endif // $10
')dnl
_POP()')
# $1 $2 $3 $4 $5 $6 $7 $8 $9
# _VFUNC_CC(vfunc_name, gtkname, cpp_rettype, c_rettype, `<cppargs>', `<carg_names>', is_const, refreturn, $ifdef)
#
define(`_VFUNC_CC',`dnl
_PUSH(SECTION_CC_VFUNCS)
ifelse(`$9',,,`#ifdef $9'
)dnl
$3 __NAMESPACE__::__CPPNAME__::$1`'($5) ifelse($7,1,const,)
{
BaseClassType *const base = static_cast<BaseClassType*>(
ifdef(`__BOOL_IS_INTERFACE__',`dnl
_IFACE_PARENT_FROM_OBJECT(gobject_)dnl
',`dnl
_PARENT_GCLASS_FROM_OBJECT(gobject_)dnl
') );
dnl g_assert(base != 0);
if(base && base->$2)
ifelse($3,void,`dnl
(*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6));
',`dnl
ifelse($8,refreturn,`dnl Assume Glib::wrap() is correct if refreturn is requested.
return Glib::wrap((*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6)), true);
',`dnl
return _CONVERT($4,$3,`(*base->$2)`'(ifelse(`$7',1,const_cast<__CNAME__*>(gobj()),gobj())`'_COMMA_PREFIX($6))');
')dnl
typedef $3 RType;
return RType`'();
')dnl
}
ifelse(`$9',,,`#endif // $9
')dnl
_POP()')
# $1 $2 $3 $4 $5
# _VFUNC_H(vfunc_name, rettype, `<cppargs>', is_const, ifndef)
# Only used for custom vfuncs.
#
define(`_VFUNC_H',`dnl
_PUSH(SECTION_H_VFUNCS)
ifelse(`$5',,,`#ifdef $5'
)dnl
ifelse($4,`1',`dnl
virtual $2 $1`'($3) const;
',`dnl
virtual $2 $1`'($3);
')
ifelse(`$5',,,`#endif // $5
')dnl
_POP()')

View file

@ -0,0 +1,494 @@
# gtkmm - DocsParser module
#
# Copyright 2001 Free Software Foundation
#
# 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.
#
# Based on XML::Parser tutorial found at http://www.devshed.com/Server_Side/Perl/PerlXML/PerlXML1/page1.html
# This module isn't properly Object Orientated because the XML Parser needs global callbacks.
package DocsParser;
use XML::Parser;
use strict;
use warnings;
# use Util;
use Function;
use GtkDefs;
use Object;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = ( );
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = ( );
}
our @EXPORT_OK;
#####################################
use strict;
use warnings;
#####################################
$DocsParser::CurrentFile = "";
$DocsParser::refAppendTo = undef; # string reference to store the data into
$DocsParser::currentParam = undef;
$DocsParser::objCurrentFunction = undef; #Function
%DocsParser::hasharrayFunctions = (); #Function elements
#~ $DocsParser::bOverride = 0; #First we parse the C docs, then we parse the C++ override docs.
$DocsParser::commentStart = " /** ";
$DocsParser::commentMiddleStart = " * ";
$DocsParser::commentEnd = " */";
sub read_defs($$$)
{
my ($path, $filename, $filename_override) = @_;
my $objParser = new XML::Parser(ErrorContext => 0);
$objParser->setHandlers(Start => \&parse_on_start, End => \&parse_on_end, Char => \&parse_on_cdata);
# C documentation:
$DocsParser::CurrentFile = "$path/$filename";
if ( ! -r $DocsParser::CurrentFile)
{
print "DocsParser.pm: Warning: Can't read file \"" . $DocsParser::CurrentFile . "\".\n";
return;
}
# Parse
eval { $objParser->parsefile($DocsParser::CurrentFile) };
if( $@ )
{
$@ =~ s/at \/.*?$//s;
print "\nError in \"" . $DocsParser::CurrentFile . "\":$@\n";
return;
}
# C++ overide documentation:
$DocsParser::CurrentFile = "$path/$filename_override";
if ( ! -r $DocsParser::CurrentFile)
{
print "DocsParser.pm: Warning: Can't read file \"" . $DocsParser::CurrentFile . "\".\n";
return;
}
# Parse
eval { $objParser->parsefile($DocsParser::CurrentFile) };
if( $@ )
{
$@ =~ s/at \/.*?$//s;
print "\nError in \"" . $DocsParser::CurrentFile . "\":$@";
return;
}
}
sub parse_on_start($$%)
{
my ($objParser, $tag, %attr) = @_;
$tag = lc($tag);
if($tag eq "function")
{
if(defined $DocsParser::objCurrentFunction)
{
$objParser->xpcroak("\nClose a function tag before you open another one.");
}
my $functionName = $attr{name};
#Reuse existing Function, if it exists:
#(For instance, if this is the override parse)
$DocsParser::objCurrentFunction = $DocsParser::hasharrayFunctions{$functionName};
if(!$DocsParser::objCurrentFunction)
{
#Make a new one if necessary:
$DocsParser::objCurrentFunction = Function::new_empty();
# The idea is to change the policy a bit:
# If a function is redefined in a later parsing run only values which are redefined
# will be overwritten. For the name this is trivial. The description is simply rewritten.
# Same goes for the return description and the class mapping. Only exception is the
# parameter list. Everytime we enter a <parameters> tag the list is emptied again.
$$DocsParser::objCurrentFunction{name} = $functionName;
$$DocsParser::objCurrentFunction{description} = "";
$$DocsParser::objCurrentFunction{param_names} = [];
$$DocsParser::objCurrentFunction{param_descriptions} = ();
$$DocsParser::objCurrentFunction{return_description} = "";
$$DocsParser::objCurrentFunction{mapped_class} = "";
# We don't need this any more, the only reference to this field is commented
# $$DocsParser::objCurrentFunction{description_overridden} = $DocsParser::bOverride;
}
}
elsif($tag eq "parameters")
{
$$DocsParser::objCurrentFunction{param_names} = [];
$$DocsParser::objCurrentFunction{param_descriptions} = ();
}
elsif($tag eq "parameter")
{
$DocsParser::currentParam = $attr{name};
$$DocsParser::objCurrentFunction{param_descriptions}->{$DocsParser::currentParam} = "";
}
elsif($tag eq "description")
{
$$DocsParser::objCurrentFunction{description} = "";
# Set destination for parse_on_cdata().
$DocsParser::refAppendTo = \$$DocsParser::objCurrentFunction{description};
}
elsif($tag eq "parameter_description")
{
# Set destination for parse_on_cdata().
my $param_desc = \$$DocsParser::objCurrentFunction{param_descriptions};
$DocsParser::refAppendTo = \$$param_desc->{$DocsParser::currentParam};
}
elsif($tag eq "return")
{
$$DocsParser::objCurrentFunction{return_description} = "";
# Set destination for parse_on_cdata().
$DocsParser::refAppendTo = \$$DocsParser::objCurrentFunction{return_description};
}
elsif($tag eq "mapping")
{
$$DocsParser::objCurrentFunction{mapped_class} = $attr{class};
}
elsif($tag ne "root")
{
$objParser->xpcroak("\nUnknown tag \"$tag\".");
}
}
sub parse_on_end($$)
{
my ($parser, $tag) = @_;
# Clear destination for parse_on_cdata().
$DocsParser::refAppendTo = undef;
$tag = lc($tag);
if($tag eq "function")
{
# Store the Function structure in the array:
my $functionName = $$DocsParser::objCurrentFunction{name};
$DocsParser::hasharrayFunctions{$functionName} = $DocsParser::objCurrentFunction;
$DocsParser::objCurrentFunction = undef;
}
elsif($tag eq "parameter")
{
# <parameter name="returns"> and <return> means the same.
if($DocsParser::currentParam eq "returns")
{
my $param_descriptions = \$$DocsParser::objCurrentFunction{param_descriptions};
my $return_description = \$$DocsParser::objCurrentFunction{return_description};
$$return_description = delete $$param_descriptions->{"returns"};
}
else
{
# Append to list of parameters.
push(@{$$DocsParser::objCurrentFunction{param_names}}, $DocsParser::currentParam);
}
$DocsParser::currentParam = undef;
}
}
sub parse_on_cdata($$)
{
my ($parser, $data) = @_;
if(defined $DocsParser::refAppendTo)
{
# Dispatch $data to the current destination string.
$$DocsParser::refAppendTo .= $data;
}
}
# $strCommentBlock lookup_documentation($strFunctionName)
sub lookup_documentation($$)
{
my ($functionName, $deprecation_docs) = @_;
my $objFunction = $DocsParser::hasharrayFunctions{$functionName};
if(!$objFunction)
{
#print "DocsParser.pm: Warning: function not found: $functionName\n";
return ""
}
my $text = $$objFunction{description};
if(length($text) eq 0)
{
print "DocsParser.pm: Warning: No C docs for function: \"$functionName\"\n";
}
DocsParser::convert_docs_to_cpp($objFunction, \$text);
#Add note about deprecation if we have specified that in our _WRAP_METHOD() call:
if($deprecation_docs ne "")
{
$text .= "\n\@deprecated $deprecation_docs";
}
DocsParser::append_parameter_docs($objFunction, \$text);
DocsParser::append_return_docs($objFunction, \$text);
# Escape the space after "i.e." or "e.g." in the brief description.
$text =~ s/^([^.]*\b(?:i\.e\.|e\.g\.))\s/$1\\ /;
# Convert to Doxygen-style comment.
$text =~ s/\n/\n${DocsParser::commentMiddleStart}/g;
$text = $DocsParser::commentStart . $text;
$text .= "\n${DocsParser::commentEnd}\n";
return $text;
}
sub append_parameter_docs($$)
{
my ($obj_function, $text) = @_;
my @param_names = @{$$obj_function{param_names}};
my $param_descriptions = \$$obj_function{param_descriptions};
# Strip first parameter if this is a method.
my $defs_method = GtkDefs::lookup_method_dont_mark($$obj_function{name});
# the second alternative is for use with method-mappings meaning:
# this function is mapped into this Gtk::class
shift(@param_names) if(($defs_method && $$defs_method{class} ne "") ||
($$obj_function{mapped_class} ne ""));
foreach my $param (@param_names)
{
my $desc = $$param_descriptions->{$param};
$param =~ s/([a-zA-Z0-9]*(_[a-zA-Z0-9]+)*)_?/$1/g;
DocsParser::convert_docs_to_cpp($obj_function, \$desc);
if(length($desc) > 0)
{
$desc .= '.' unless($desc =~ /(?:^|\.)$/);
$$text .= "\n\@param ${param} \u${desc}";
}
}
}
sub append_return_docs($$)
{
my ($obj_function, $text) = @_;
my $desc = $$obj_function{return_description};
DocsParser::convert_docs_to_cpp($obj_function, \$desc);
$desc =~ s/\.$//;
$$text .= "\n\@return \u${desc}." unless($desc eq "");
}
sub convert_docs_to_cpp($$)
{
my ($obj_function, $text) = @_;
# Chop off leading and trailing whitespace.
$$text =~ s/^\s+//;
$$text =~ s/\s+$//;
# HagenM: this is the only reference to $$obj_function{description_overridden}
# and it seems not to be in use.
# if(!$$obj_function{description_overridden})
# {
# Convert C documentation to C++.
DocsParser::convert_tags_to_doxygen($text);
DocsParser::substitute_identifiers($$obj_function{name}, $text);
$$text =~ s/\bX\s+Window\b/X&nbsp;\%Window/g;
$$text =~ s/\bWindow\s+manager/\%Window manager/g;
# }
}
sub convert_tags_to_doxygen($)
{
my ($text) = @_;
for($$text)
{
# Replace format tags.
s"&lt;(/?)emphasis&gt;"<$1em>"g;
s"&lt;(/?)literal&gt;"<$1tt>"g;
s"&lt;(/?)function&gt;"<$1tt>"g;
# Some argument names are suffixed by "_" -- strip this.
# gtk-doc uses @thearg, but doxygen uses @a thearg.
s" ?\@([a-zA-Z0-9]*(_[a-zA-Z0-9]+)*)_?\b" \@a $1 "g;
s"^Note ?\d?: "\@note "mg;
s"&lt;/?programlisting&gt;""g;
s"&lt;informalexample&gt;"\@code"g;
s"&lt;/informalexample&gt;"\@endcode"g;
s"&lt;!&gt;""g;
# Remove all link tags.
s"&lt;/?u?link[^&]*&gt;""g;
# Remove all para tags (from tmpl sgml files).
s"&lt;/?para&gt;""g;
# Use our doxgen since/newin tags:
# TODO: Do this generically, regardless of the number:
s"Since: 2\.2"\@newin2p2"mg;
s"Since: 2\.4"\@newin2p4"mg;
s"Since: 2\.6"\@newin2p6"mg;
s"Since: 2\.8"\@newin2p8"mg;
s"Since: 2\.10"\@newin2p10"mg;
s"Since: 2\.12"\@newin2p12"mg;
s"Since: 2\.14"\@newin2p14"mg;
s"Since: 2\.16"\@newin2p16"mg;
s"Since: 2\.18"\@newin2p18"mg;
s"\b-&gt;\b"->"g;
# Doxygen is too dumb to handle &mdash;
s"&mdash;" \@htmlonly&mdash;\@endhtmlonly "g;
s"\%?FALSE\b"<tt>false</tt>"g;
s"\%?TRUE\b"<tt>true</tt>"g;
s"\%?NULL\b"<tt>0</tt>"g;
s"#?\bgboolean\b"<tt>bool</tt>"g;
s"#?\bg(int|short|long)\b"<tt>$1</tt>"g;
s"#?\bgu(int|short|long)\b"<tt>unsigned $1</tt>"g;
# For Gtk::TextIter.
s"(\\[rn])\b"<tt>\\$1</tt>"g;
}
}
sub substitute_identifiers($$)
{
my ($doc_func, $text) = @_;
for($$text)
{
# TODO: handle more than one namespace
s/[#%]([A-Z][a-z]*)([A-Z][A-Za-z]+)\b/$1::$2/g; # type names
s/[#%]([A-Z])([A-Z]*)_([A-Z\d_]+)\b/$1\L$2\E::$3/g; # enum values
# Undo wrong substitutions.
s/\bHas::/HAS_/g;
s/\bNo::/NO_/g;
# Replace C function names with C++ counterparts.
s/\b([a-z]+_[a-z][a-z\d_]+) ?\(\)/&DocsParser::substitute_function($doc_func, $1)/eg;
}
}
sub substitute_function($$)
{
my ($doc_func, $name) = @_;
if(my $defs_method = GtkDefs::lookup_method_dont_mark($name))
{
if(my $defs_object = DocsParser::lookup_object_of_method($$defs_method{class}, $name))
{
my $module = $$defs_object{module};
my $class = $$defs_object{name};
DocsParser::build_method_name($doc_func, $module, $class, \$name);
}
}
else
{
# Not perfect, but better than nothing.
$name =~ s/^g_/Glib::/;
}
return $name . "()";
}
sub lookup_object_of_method($$)
{
my ($object, $name) = @_;
if($object ne "")
{
# We already know the C object name, because $name is a non-static method.
return GtkDefs::lookup_object($object);
}
my @parts = split(/_/, $name);
pop(@parts);
# (gtk, foo, bar) -> (Gtk, Foo, Bar)
foreach(@parts) { $_ = (length > 2) ? ucfirst : uc; }
# Do a bit of try'n'error.
while(scalar(@parts) > 1)
{
my $try = join("", @parts);
if(my $defs_object = GtkDefs::lookup_object($try))
{ return $defs_object; }
pop(@parts);
}
return undef;
}
sub build_method_name($$$$)
{
my ($doc_func, $module, $class, $name) = @_;
my $prefix = $module . $class;
$prefix =~ s/([a-z])([A-Z])/$1_$2/g;
$prefix = lc($prefix) . '_';
if($$name =~ /^$prefix/)
{
my $scope = "";
$scope = "${module}::${class}::" unless($doc_func =~ /^$prefix/);
substr($$name, 0, length($prefix)) = $scope;
}
}
1; # indicate proper module load.

View file

@ -0,0 +1,246 @@
package Enum;
use strict;
use warnings;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = ( );
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = ( );
}
our @EXPORT_OK;
# class Enum
# {
# bool flags;
# string type;
# string module;
# string c_type;
#
# string array elem_names;
# string array elem_values;
#
# bool mark;
# }
sub new
{
my ($def) = @_;
my $self = {};
bless $self;
$def =~ s/^\(//;
$def =~ s/\)$//;
$$self{mark} = 0;
$$self{flags} = 0;
$$self{elem_names} = [];
$$self{elem_values} = [];
# snarf down the fields
if($def =~ s/^define-(enum|flags)-extended (\S+)//)
{
$$self{type} = $2;
$$self{flags} = 1 if($1 eq "flags");
}
$$self{module} = $1 if($def =~ s/\(in-module "(\S+)"\)//);
$$self{c_type} = $1 if($def =~ s/\(c-name "(\S+)"\)//);
# values are compound lisp statement
if($def =~ s/\(values((?: '\("\S+" "\S+" "[^"]+"\))*) \)//)
{
$self->parse_values($1);
}
if($def !~ /^\s*$/)
{
GtkDefs::error("Unhandled enum def ($def) in $$self{module}\::$$self{type}\n")
}
# this should never happen
warn if(scalar(@{$$self{elem_names}}) != scalar(@{$$self{elem_values}}));
return $self;
}
sub parse_values($$)
{
my ($self, $value) = @_;
my $elem_names = [];
my $elem_values = [];
my $common_prefix = undef;
# break up the value statements
foreach(split(/\s*'*[()]\s*/, $value))
{
next if($_ eq "");
if(/^"\S+" "(\S+)" "([^"]+)"$/)
{
my ($name, $value) = ($1, $2);
# detect whether there is module prefix common to all names, e.g. GTK_
my $prefix = $1 if ($name =~ /^([^_]+_)/);
if (not defined($common_prefix))
{
$common_prefix = $prefix;
}
elsif ($prefix ne $common_prefix)
{
$common_prefix = "";
}
push(@$elem_names, $name);
push(@$elem_values, $value);
}
else
{
GtkDefs::error("Unknown value statement ($_) in $$self{c_type}\n");
}
}
if ($common_prefix)
{
# cut off the module prefix, e.g. GTK_
s/^$common_prefix// foreach (@$elem_names);
}
$$self{elem_names} = $elem_names;
$$self{elem_values} = $elem_values;
}
sub beautify_values($)
{
my ($self) = @_;
return if($$self{flags});
my $elem_names = $$self{elem_names};
my $elem_values = $$self{elem_values};
my $num_elements = scalar(@$elem_values);
return if($num_elements == 0);
my $first = $$elem_values[0];
return if($first !~ /^-?[0-9]+$/);
my $prev = $first;
# Continuous? (Aliases to prior enum values are allowed.)
foreach my $value (@$elem_values)
{
return if(($value < $first) || ($value > $prev + 1));
$prev = $value;
}
# This point is reached only if the values are a continuous range.
# 1) Let's kill all the superfluous values, for better readability.
# 2) Substitute aliases to prior enum values.
my %aliases = ();
for(my $i = 0; $i < $num_elements; ++$i)
{
my $value = \$$elem_values[$i];
my $alias = \$aliases{$$value};
if(defined($$alias))
{
$$value = $$alias;
}
else
{
$$alias = $$elem_names[$i];
$$value = "" unless($first != 0 && $$value == $first);
}
}
}
sub build_element_list($$$$)
{
my ($self, $ref_flags, $ref_no_gtype, $indent) = @_;
my @subst_in = [];
my @subst_out = [];
# Build a list of custom substitutions, and recognize some flags too.
foreach(@$ref_flags)
{
if(/^\s*(NO_GTYPE)\s*$/)
{
$$ref_no_gtype = $1;
}
elsif(/^\s*(get_type_func=)(\s*)\s*$/)
{
my $part1 = $1;
my $part2 = $2;
}
elsif(/^\s*s#([^#]+)#([^#]*)#\s*$/)
{
push(@subst_in, $1);
push(@subst_out, $2);
}
elsif($_ !~ /^\s*$/)
{
return undef;
}
}
my $elem_names = $$self{elem_names};
my $elem_values = $$self{elem_values};
my $num_elements = scalar(@$elem_names);
my $elements = "";
for(my $i = 0; $i < $num_elements; ++$i)
{
my $name = $$elem_names[$i];
my $value = $$elem_values[$i];
for(my $ii = 0; $ii < scalar(@subst_in); ++$ii)
{
$name =~ s/${subst_in[$ii]}/${subst_out[$ii]}/;
$value =~ s/${subst_in[$ii]}/${subst_out[$ii]}/;
}
$elements .= "${indent}${name}";
$elements .= " = ${value}" if($value ne "");
$elements .= ",\n" if($i < $num_elements - 1);
}
return $elements;
}
sub dump($)
{
my ($self) = @_;
print "<enum module=\"$$self{module}\" type=\"$$self{type}\" flags=$$self{flags}>\n";
my $elem_names = $$self{elem_names};
my $elem_values = $$self{elem_values};
for(my $i = 0; $i < scalar(@$elem_names); ++$i)
{
print " <element name=\"$$elem_names[$i]\" value=\"$$elem_values[$i]\"/>\n";
}
print "</enum>\n\n";
}
1; # indicate proper module load.

View file

@ -0,0 +1,351 @@
package Function;
use strict;
use warnings;
use Util;
use FunctionBase;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(FunctionBase);
@EXPORT = qw(&func1 &func2 &func4);
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw($Var1 %Hashit &func3);
}
our @EXPORT_OK;
##################################################
### Function
# Commonly used algorithm for parsing a function declaration into
# its component pieces
#
# class Function : FunctionBase
# {
# string rettype;
# bool const;
# bool static;
# string name; e.g. gtk_accelerator_valid
# string c_name;
# string array param_type;
# string array param_name;
# string array param_default_value;
# string in_module; e.g. Gtk
# string signal_when. e.g. first, last, or both.
# string class e.g. GtkButton ( == of-object. Useful for signal because their names are not unique.
# string entity_type. e.g. method or signal
# }
sub new_empty()
{
my $self = {};
bless $self;
return $self;
}
# $objFunction new($function_declaration, $objWrapParser)
sub new($$)
{
#Parse a function/method declaration.
#e.g. guint gtk_something_set_thing(guint a, const gchar* something)
my ($line, $objWrapParser) = @_;
my $self = {};
bless $self;
#Initialize member data:
$$self{rettype} = "";
$$self{rettype_needs_ref} = 0; #Often the gtk function doesn't do an extra ref for the receiver.
$$self{const} = 0;
$$self{name} = "";
$$self{param_types} = [];
$$self{param_names} = [];
$$self{param_default_values} = [];
$$self{in_module} = "";
$$self{class} = "";
$$self{entity_type} = "method";
$line =~ s/^\s+//; # Remove leading whitespace.
$line =~ s/\s+/ /g; # Compress white space.
if ($line =~ /^static\s+([^()]+)\s+(\S+)\s*\((.*)\)\s*$/)
{
$$self{rettype} = $1;
$$self{name} = $2;
$$self{c_name} = $2;
$self->parse_param($3);
$$self{static} = 1;
}
elsif ($line =~ /^([^()]+)\s+(\S+)\s*\((.*)\)\s*(const)*$/)
{
no warnings qw(uninitialized); # disable the uninitialize warning for $4
$$self{rettype} = $1;
$$self{name} = $2;
$$self{c_name} = $2;
$self->parse_param($3);
$$self{const} = ($4 eq "const");
}
else
{
$objWrapParser->error("fail to parse $line\n");
}
return $self;
}
# $objFunction new_ctor($function_declaration, $objWrapParser)
# Like new(), but the function_declaration doesn't need a return type.
sub new_ctor($$)
{
#Parse a function/method declaration.
#e.g. guint gtk_something_set_thing(guint a, const gchar* something)
my ($line, $objWrapParser) = @_;
my $self = {};
bless $self;
#Initialize member data:
$$self{rettype} = "";
$$self{rettype_needs_ref} = 0;
$$self{const} = 0;
$$self{name} = "";
$$self{param_types} = [];
$$self{param_names} = [];
$$self{param_default_values} = [];
$$self{in_module} = "";
$$self{class} = "";
$$self{entity_type} = "method";
$line =~ s/^\s+//; # Remove leading whitespace.
$line =~ s/\s+/ /g; # Compress white space.
if ($line =~ /^(\S+)\s*\((.*)\)\s*/)
{
$$self{name} = $1;
$$self{c_name} = $2;
$self->parse_param($2);
}
else
{
$objWrapParser->error("fail to parse $line\n");
}
return $self;
}
# $num num_args()
sub num_args #($)
{
my ($self) = @_;
my $param_types = $$self{param_types};
return $#$param_types+1;
}
# parses C++ parameter lists.
# forms a list of types, names, and initial values
# (we don't currently use values)
sub parse_param($$)
{
my ($self, $line) = @_;
my $type = "";
my $name = "";
my $value = "";
my $id = 0;
my $has_value = 0;
my $param_types = $$self{param_types};
my $param_names = $$self{param_names};
my $param_default_values = $$self{param_default_values};
# clean up space and handle empty case
$line = string_trim($line);
$line =~ s/\s+/ /g; # Compress whitespace.
return if ($line =~ /^$/);
# parse through argument list
my @str = ();
my $par = 0;
foreach (split(/(const )|([,=&*()])|(<[^,]*>)|(\s+)/, $line)) #special characters OR <something> OR whitespace.
{
next if ( !defined($_) or $_ eq "" );
if ( $_ eq "(" ) #Detect the opening bracket.
{
push(@str, $_);
$par++; #Increment the number of parameters.
next;
}
elsif ( $_ eq ")" )
{
push(@str, $_);
$par--; #Decrement the number of parameters.
next;
}
elsif ( $par || /^(const )|(<[^,]*>)|([*&])|(\s+)/ ) #TODO: What's happening here?
{
push(@str, $_); #This looks like part of the type, so we store it.
next;
}
elsif ( $_ eq "=" ) #Default value
{
$type = join("", @str); #The type is everything before the = character.
@str = (); #Wipe it so that it will only contain the default value, which comes next.
$has_value = 1;
next;
}
elsif ( $_ eq "," ) #The end of one parameter:
{
if ($has_value)
{
$value = join("", @str); # If there's a default value, then it's the part before the next ",".
}
else
{
$type = join("", @str);
}
if ($name eq "")
{
$name = sprintf("p%s", $#$param_types + 2)
}
$type = string_trim($type);
push(@$param_types, $type);
push(@$param_names, $name);
push(@$param_default_values, $value);
#Clear variables, ready for the next parameter.
@str = ();
$type= "";
$value = "";
$has_value = 0;
$name = "";
$id = 0;
next;
}
if ($has_value)
{
push(@str, $_);
next;
}
$id++;
$name = $_ if ($id == 2);
push(@str, $_) if ($id == 1);
if ($id > 2)
{
print STDERR "Can't parse $line.\n";
print STDERR " arg type so far: $type\n";
print STDERR " arg name so far: $name\n";
print STDERR " arg default value so far: $value\n";
}
}
# handle last argument (There's no , at the end.)
if ($has_value)
{
$value = join("", @str);
}
else
{
$type = join("", @str);
}
if ($name eq "")
{
$name = sprintf("p%s", $#$param_types + 2)
}
$type = string_trim($type);
push(@$param_types, $type);
push(@$param_names, $name);
push(@$param_default_values, $value);
}
# add_parameter_autoname($, $type, $name)
# Adds e.g "sometype somename"
sub add_parameter_autoname($$)
{
my ($self, $type) = @_;
add_parameter($self, $type, "");
}
# add_parameter($, $type, $name)
# Adds e.g GtkSomething* p1"
sub add_parameter($$$)
{
my ($self, $type, $name) = @_;
$type = string_unquote($type);
$type =~ s/-/ /g;
my $param_names = $$self{param_names};
if ($name eq "")
{
$name = sprintf("p%s", $#$param_names + 2);
}
push(@$param_names, $name);
my $param_types = $$self{param_types};
push(@$param_types, $type);
return $self;
}
# $string get_refdoc_comment()
# Generate a readable prototype for signals.
sub get_refdoc_comment($)
{
my ($self) = @_;
my $str = " /**\n";
$str .= " * \@par Prototype:\n";
$str .= " * <tt>$$self{rettype} on_my_\%$$self{name}(";
my $param_names = $$self{param_names};
my $param_types = $$self{param_types};
my $num_params = scalar(@$param_types);
# List the parameters:
for(my $i = 0; $i < $num_params; ++$i)
{
$str .= $$param_types[$i] . ' ' . $$param_names[$i];
$str .= ", " if($i < $num_params - 1);
}
$str .= ")</tt>\n";
$str .= " */";
return $str;
}
sub get_is_const($)
{
my ($self) = @_;
return $$self{const};
}
1; # indicate proper module load.

View file

@ -0,0 +1,217 @@
package FunctionBase;
use strict;
use warnings;
use Util;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(&func1 &func2 &func4);
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw($Var1 %Hashit &func3);
}
our @EXPORT_OK;
##################################################
### FunctionBase
# Contains data and methods used by both Function (C++ declarations) and GtkDefs::Function (C defs descriptions)
# Note that GtkDefs::Signal inherits from GtkDefs::Function so it get these methods too.
#
# class Function : FunctionBase
# {
# string array param_types;
# string array param_names;
# string array param_documentation;
# string return_documention;
# }
# $string args_types_only($)
# comma-delimited argument types.
sub args_types_only($)
{
my ($self) = @_;
my $param_types = $$self{param_types};
return join(", ", @$param_types);
}
# $string args_names_only($)
sub args_names_only($)
{
my ($self) = @_;
my $param_names = $$self{param_names};
return join(", ", @$param_names);
}
# $string args_types_and_names($)
sub args_types_and_names($)
{
my ($self) = @_;
my $i;
my $param_names = $$self{param_names};
my $param_types = $$self{param_types};
my @out;
#debugging:
#if($#$param_types)
#{
# return "NOARGS";
#}
for ($i = 0; $i < $#$param_types + 1; $i++)
{
my $str = sprintf("%s %s", $$param_types[$i], $$param_names[$i]);
push(@out, $str);
}
my $result = join(", ", @out);
return $result;
}
# $string args_names_only_without_object($)
sub args_names_only_without_object2($)
{
my ($self) = @_;
my $param_names = $$self{param_names};
my $result = "";
my $bInclude = 0; #Ignore the first (object) arg.
foreach (@{$param_names})
{
# Add comma if there was an arg before this one:
if( $result ne "")
{
$result .= ", ";
}
# Append this arg if it's not the first one:
if($bInclude)
{
$result .= $_;
}
$bInclude = 1;
}
return $result;
}
# $string args_types_and_names_without_object($)
sub args_types_and_names_without_object($)
{
my ($self) = @_;
my $param_names = $$self{param_names};
my $param_types = $$self{param_types};
my $i = 0;
my @out;
for ($i = 1; $i < $#$param_types + 1; $i++) #Ignore the first arg.
{
my $str = sprintf("%s %s", $$param_types[$i], $$param_names[$i]);
push(@out, $str);
}
return join(", ", @out);
}
# $string args_names_only_without_object($)
sub args_names_only_without_object($)
{
my ($self) = @_;
my $param_names = $$self{param_names};
my $result = "";
my $bInclude = 0; #Ignore the first (object) arg.
foreach (@{$param_names})
{
# Add comma if there was an arg before this one:
if( $result ne "")
{
$result .= ", ";
}
# Append this arg if it's not the first one:
if($bInclude)
{
$result .= $_;
}
$bInclude = 1;
}
return $result;
}
sub dump($)
{
my ($self) = @_;
my $param_types = $$self{param_types};
my $param_names = $$self{param_names};
print "<function>\n";
foreach (keys %$self)
{
print " <$_ value=\"$$self{$_}\"/>\n" if (!ref $$self{$_} && $$self{$_} ne "");
}
if (scalar(@$param_types)>0)
{
print " <parameters>\n";
for (my $i = 0; $i < scalar(@$param_types); $i++)
{
print " \"$$param_types[$i]\" \"$$param_names[$i]\" \n";
}
print " </parameters>\n";
}
print "</function>\n\n";
}
sub args_types_and_names_with_default_values($)
{
my ($self) = @_;
my $i;
my $param_names = $$self{param_names};
my $param_types = $$self{param_types};
my $param_default_values = $$self{param_default_values};
my @out;
for ($i = 0; $i < $#$param_types + 1; $i++)
{
my $str = sprintf("%s %s", $$param_types[$i], $$param_names[$i]);
if(defined($$param_default_values[$i]))
{
if($$param_default_values[$i] ne "")
{
$str .= " = " . $$param_default_values[$i];
}
}
push(@out, $str);
}
return join(", ", @out);
}
1; # indicate proper module load.

View file

@ -0,0 +1,635 @@
# gtkmm - GtkDefs module
#
# Copyright 2001 Free Software Foundation
#
# 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.
#
package GtkDefs;
use strict;
use warnings;
use Util;
use Enum;
use Object;
use Property;
use FunctionBase;
#
# Public functions
# read_defs(path, file)
#
# @ get_methods()
# @ get_signals()
# @ get_properties()
#
# $ lookup_enum(c_type)
# $ lookup_object(c_name)
# $ lookup_method(c_name)
# $ lookup_function(c_name)
# $ lookup_property(object, c_name)
# $ lookup_signal(object, c_name)
#
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = ( );
%EXPORT_TAGS = ( );
# your exported package globals go here,
# # as well as any optionally exported functions
@EXPORT_OK = ( );
}
our @EXPORT_OK;
#####################################
use strict;
use warnings;
#####################################
%GtkDefs::enums = (); #Enum
%GtkDefs::objects = (); #Object
%GtkDefs::methods = (); #GtkDefs::Function
%GtkDefs::signals = (); #GtkDefs::Signal
%GtkDefs::properties = (); #Property
@GtkDefs::read = ();
@GtkDefs::file = ();
#####################################
#prototype to get rid of warning
sub read_defs($$;$);
sub read_defs($$;$)
{
my ($path, $filename, $restrict) = @_;
$restrict = "" if ($#_ < 2);
# check that the file is there.
if ( ! -r "$path/$filename")
{
print "Error: can't read defs file $filename\n";
return;
}
# break the tokens into lisp phrases up to three levels deep.
# WARNING: reading the following perl statement may induce seizures,
# please flush eyes with water immediately, and consult a mortician.
my @tokens = split(
m/(
\(
(?:
[^()]*
\(
(?:
[^()]*
\(
[^()]*
\)
)*
[^()]*
\)
)*
[^()]*
\)
)/x,
read_file($path, $filename));
# scan through top level tokens
while ($#tokens > -1)
{
my $token = shift @tokens;
next if ($token =~ /^\s*$/);
if ($token =~ /\(include (\S+)\)/)
{
read_defs($path,$1,$restrict);
next;
}
elsif ($token =~ /^\(define-flags-extended.*\)$/)
{ on_enum($token); }
elsif ($token =~ /^\(define-enum-extended.*\)$/)
{ on_enum($token); }
elsif ($token =~ /^\(define-flags.*\)$/)
{ }
elsif ($token =~ /^\(define-enum.*\)$/)
{ }
elsif ($token =~ /^\(define-object.*\)$/)
{ on_object($token); }
elsif ($token =~ /^\(define-function.*\)$/)
{ on_function($token); }
elsif ($token =~ /^\(define-method.*\)$/)
{ on_method($token); }
elsif ($token =~ /^\(define-property.*\)$/)
{ on_property($token); }
elsif ($token =~ /^\(define-signal.*\)$/)
{ on_signal($token); }
elsif ($token =~ /^\(define-vfunc.*\)$/)
{ on_vfunc($token); }
else
{
if ( $token =~ /^\(define-(\S+) (\S+)/)
{
# FIXME need to figure out the line number.
print STDERR "Broken lisp definition for $1 $2.\n";
}
else
{
print "unknown token $token \n";
}
}
}
}
sub read_file($$)
{
my ($path, $filename)=@_;
my @buf = ();
# don't read a file twice
foreach (@GtkDefs::read)
{
return "" if ($_ eq "$path/$filename");
}
push @GtkDefs::read, "$path/$filename";
# read file while stripping comments
open(FILE, "$path/$filename");
while (<FILE>)
{
s/^;.*$//; # remove comments
chop; # remove new lines
push(@buf, $_);
}
close(FILE);
$_ = join("", @buf);
s/\s+/ /g;
return $_;
}
sub on_enum($)
{
my $thing = Enum::new(shift(@_));
$GtkDefs::enums{$$thing{c_type}} = $thing;
}
sub on_object($)
{
my $thing = Object::new(shift(@_));
$GtkDefs::objects{$$thing{c_name}} = $thing;
}
sub on_function($)
{
my $thing = GtkDefs::Function::new(shift(@_));
$GtkDefs::methods{$$thing{c_name}} = $thing;
}
sub on_method($)
{
my $thing = GtkDefs::Function::new(shift(@_));
$GtkDefs::methods{$$thing{c_name}} = $thing if ($thing);
}
sub on_property($)
{
my $thing = Property::new(shift(@_));
$GtkDefs::properties{"$$thing{class}::$$thing{name}"} = $thing;
}
sub on_signal($)
{
my $thing = GtkDefs::Signal::new(shift(@_));
$GtkDefs::signals{"$$thing{class}::$$thing{name}"} = $thing;
}
sub on_vfunc($)
{
my $thing = GtkDefs::Signal::new(shift(@_));
$GtkDefs::signals{"$$thing{class}::$$thing{name}"} = $thing;
}
##########################
sub get_enums
{
return sort {$$a{c_type} cmp $$b{c_type}} values %GtkDefs::enums;
}
sub get_methods
{
return sort {$$a{c_name} cmp $$b{c_name}} values %GtkDefs::methods;
}
sub get_signals
{
return sort {$$a{name} cmp $$b{name}} values %GtkDefs::signals;
}
sub get_properties
{
return sort {$$a{name} cmp $$b{name}} values %GtkDefs::properties;
}
sub get_marked
{
no warnings;
return grep {$$_{mark}==1} values %GtkDefs::methods;
}
# This searches for items wrapped by this file and then tries to locate
# other functions/signal/properties which may have been left unmarked.
sub get_unwrapped
{
# find methods which were used in for a _WRAP
my @targets;
push @targets,grep {$$_{entity_type} eq "method" && $$_{mark}==1} values %GtkDefs::methods;
push @targets,grep {$$_{mark}==1} values %GtkDefs::signals;
push @targets,grep {$$_{mark}==1} values %GtkDefs::properties;
# find the classes which used them.
my @classes = join(" ", unique(map { $$_{class} } @targets));
# find methods which are in those classes which didn't get marked.
my @unwrapped;
my $class;
foreach $class (@classes)
{
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0} values %GtkDefs::methods;
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0} values %GtkDefs::properties;
push @unwrapped, grep {$$_{class} eq $class && $$_{mark}==0} values %GtkDefs::signals;
}
return @unwrapped;
}
##########################
sub lookup_enum($)
{
no warnings;
my ($c_type) = @_;
my $obj = $GtkDefs::enums{$c_type};
return 0 if(!$obj);
$$obj{mark} = 1;
return $obj;
}
sub lookup_object($)
{
no warnings;
return $GtkDefs::objects{$_[0]};
}
# $objProperty lookup_property($name, $parent_object_name)
sub lookup_property($$)
{
no warnings;
my ($parent_object_name, $name) = @_;
$name =~ s/-/_/g;
my $obj = $GtkDefs::properties{"${parent_object_name}::${name}"};
return 0 if ($obj eq "");
$$obj{mark} = 1;
return $obj;
}
sub lookup_method_dont_mark($)
{
no warnings;
my ($c_name) = @_;
$c_name =~ s/-/_/g;
my $obj = $GtkDefs::methods{$c_name};
return 0 if ($obj eq "");
return $obj;
}
sub lookup_method($)
{
my $obj = lookup_method_dont_mark($_);
$$obj{mark} = 1 if($obj);
return $obj;
}
sub lookup_function($)
{
return lookup_method($_[0]);
}
sub lookup_signal($$)
{
no warnings;
my ($parent_object_name, $name) = @_;
$name =~ s/-/_/g;
my $obj = $GtkDefs::signals{"${parent_object_name}::${name}"};
return 0 if ($obj eq "");
$$obj{mark} = 1;
return $obj;
}
sub error
{
my $format = shift @_;
printf STDERR "GtkDefs.pm: $format\n", @_;
}
########################################################################
package GtkDefs::Function;
BEGIN { @GtkDefs::Function::ISA=qw(FunctionBase); }
# class Function : FunctionBase
#
# {
# string name; e.g. gtk_accelerator_valid
# string c_name;
# string class e.g. GtkButton
#
# string rettype;
# string array param_types;
# string array param_names;
#
# string entity_type. e.g. method or signal
#
# bool varargs;
# bool mark;
#
# }
# "new" can't have prototype
sub new
{
my ($def) = @_;
my $whole = $def;
my $self = {};
bless $self;
$def =~ s/^\(//;
$def =~ s/\)$//;
$def =~ s/^\s*define-(\S+)\s+(\S+)\s*//;
$$self{entity_type} = $1;
$$self{name} = $2;
$$self{name} =~ s/-/_/g; # change - to _
# init variables
$$self{mark} = 0;
$$self{rettype} = "none";
$$self{param_types} = [];
$$self{param_names} = [];
$$self{class} = "";
# snarf down lisp fields
$$self{c_name} = $1 if ($def=~s/\(c-name "(\S+)"\)//);
$$self{class} = $1 if ($def=~s/\(of-object "(\S+)"\)//);
if ($def =~ s/\(return-type "(\S+)"\)//)
{
$$self{rettype} = $1;
$$self{rettype} =~ s/-/ /g; #e.g. replace const-gchar* with const gchar*. Otherwise it will be used in code.
}
$$self{varargs} = 1 if ($def=~s/\(varargs\s+#t\)//);
$$self{rettype} = "void" if ($$self{rettype} eq "none");
# methods have a parameter not stated in the defs file
if ($$self{entity_type} eq "method")
{
push( @{$$self{param_types}}, "$$self{class}*" );
push( @{$$self{param_names}}, "self" );
}
# parameters are compound lisp statement
if ($def =~ s/\(parameters(( '\("\S+" "\S+"\))*) \)//)
{
$self->parse_param($1);
}
# is-constructor-of:
if ($def =~ s/\(is-constructor-of "(\S+)"\)//)
{
#Ignore them.
}
# of-object
if ($def =~ s/\(of-object "(\S+)"\)//)
{
#Ignore them.
}
GtkDefs::error("Unhandled function parameter ($def) in $$self{c_name}\n")
if ($def !~ /^\s*$/);
return $self;
}
sub parse_param($$)
{
my ($self, $param) = @_;
# break up the parameter statements
foreach (split(/\s*'*[()]\s*/, $param))
{
next if ($_ eq "");
if (/^"(\S+)" "(\S+)"$/)
{
my ($p1, $p2) = ($1,$2);
$p1 =~ s/-/ /;
push( @{$$self{param_types}}, $p1);
push( @{$$self{param_names}}, $p2);
}
else
{
GtkDefs::error("Unknown parameter statement ($_) in $$self{c_name}\n");
}
}
}
# $string get_return_type_for_methods().
# Changes gchar* (not const-gchar*) to return-gchar* so that _CONVERT knows that it needs to be freed.
sub get_return_type_for_methods($)
{
my ($self) = @_;
my $rettype = $$self{rettype};
if($rettype eq "gchar*" || $rettype eq "char*")
{
$rettype = "return-" . $rettype;
}
return $rettype;
}
sub get_param_names
{
my ($self) = @_;
return @$self{param_names};
}
######################################################################
package GtkDefs::Signal;
BEGIN { @GtkDefs::Signal::ISA=qw(GtkDefs::Function); }
# class Signal : Function
# {
# string name; e.g. gtk_accelerator_valid
# string class e.g. GtkButton ( == of-object.)
#
# string rettype;
#
# string when. e.g. first, last, or both.
# string entity_type. e.g. method or signal
# }
# "new" can't have prototype
sub new
{
my ($def) = @_;
my $whole = $def;
my $self = {};
bless $self;
#Remove first and last braces:
$def =~ s/^\(//;
$def =~ s/\)$//;
$def =~ s/^\s*define-(\S+)\s+(\S+)\s*//;
$$self{entity_type} = $1;
$$self{name} = $2;
$$self{name} =~ s/-/_/g; #change - to _
# init variables
$$self{mark}=0;
$$self{rettype} = "none";
$$self{param_types} = [];
$$self{param_names} = [];
$$self{when} = "";
$$self{class} = "";
# snarf down lisp fields
if($def =~ s/\(of-object "(\S+)"\)//)
{
$$self{class} = $1;
}
else
{
GtkDefs::error("define-signal/define-vfunc without of-object (entity type: $$self{entity_type}): $whole");
}
if($def =~ s/\(return-type "(\S+)"\)//)
{
$$self{rettype} = $1;
$$self{rettype} =~ s/-/ /g; #e.g. replace const-gchar* with const gchar*. Otherwise it will be used in code.
}
if($def =~ s/\(when "(\S+)"\)//)
{
$$self{when} = $1;
}
if($$self{rettype} eq "none")
{
$$self{rettype} = "void"
}
# signals always have a parameter
push(@{$$self{param_types}}, "$$self{class}*");
push(@{$$self{param_names}}, "self");
# parameters are compound lisp statement
if ($def =~ s/\(parameters(( '\("\S+" "\S+"\))+) \)//)
{
$self->parse_param($1);
}
if ($def!~/^\s*$/)
{
GtkDefs::error("Unhandled signal/vfunc def ($def) in $$self{class}::$$self{name}");
}
return $self;
}
# bool has_same_types($objFunction)
# Compares return types and argument types
sub has_same_types($$)
{
my ($self, $objFuncOther) = @_;
#Compare return types:
if($self->types_are_equal($$self{rettype}, $$objFuncOther{rettype}) ne 1)
{
# printf("debug: different return types: %s, %s\n", $$self{rettype}, $$objFuncOther{rettype});
return 0; #Different types found.
}
#Compare arguement types:
my $i = 0;
my $param_types = $$self{param_types};
my $param_types_other = $$objFuncOther{param_types};
for ($i = 1; $i < $#$param_types + 1; $i++)
{
my $type_a = $$param_types[$i];
my $type_b = $$param_types_other[$i-1];
if($self->types_are_equal($type_a, $type_b) ne 1)
{
# printf("debug: different arg types: %s, %s\n", $type_a, $type_b);
return 0; #Different types found.
}
}
return 1; #They must all be the same for it to get this far.
}
# bool types_are_equal($a, $b)
# Compares types, ignoring gint/int differences, etc.
sub types_are_equal($$$)
{
#TODO: Proper method of getting a normalized type name.
my ($self, $type_a, $type_b) = @_;
if($type_a ne $type_b)
{
#Try adding g to one of them:
if( ("g" . $type_a) ne $type_b )
{
#Try adding g to the other one:
if( $type_a ne ("g" . $type_b) )
{
#After all these checks it's still not equal:
return 0; #not equal.
}
}
}
# printf("DEBUG: types are equal: %s, %s\n", $$type_a, $$type_b);
return 1; #They must be the same for it to get this far.
}
1; # indicate proper module load.

View file

@ -0,0 +1,10 @@
include $(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment
EXTRA_DIST = Makefile_list_of_sources.am_fragment $(files_tools_pm)
# Install the .pm, files:
tools_pm_includedir = $(libdir)/glibmm-2.4/proc/pm
tools_pm_include_HEADERS = $(files_tools_pm)

View file

@ -0,0 +1,432 @@
# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(tools_pm_include_HEADERS) \
$(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment
subdir = tools/pm
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/scripts/c_std.m4 \
$(top_srcdir)/scripts/cxx.m4 $(top_srcdir)/scripts/cxx_std.m4 \
$(top_srcdir)/scripts/docgen.m4 \
$(top_srcdir)/scripts/glibmm_check_perl.m4 \
$(top_srcdir)/scripts/macros.m4 \
$(top_srcdir)/scripts/reduced.m4 $(top_srcdir)/scripts/sun.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h \
$(top_builddir)/glib/glibmmconfig.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(tools_pm_includedir)"
tools_pm_includeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(tools_pm_include_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DISABLE_DEPRECATED_API_CFLAGS = @DISABLE_DEPRECATED_API_CFLAGS@
DISABLE_DEPRECATED_CFLAGS = @DISABLE_DEPRECATED_CFLAGS@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GLIBMM_CFLAGS = @GLIBMM_CFLAGS@
GLIBMM_LIBS = @GLIBMM_LIBS@
GLIBMM_MAJOR_VERSION = @GLIBMM_MAJOR_VERSION@
GLIBMM_MICRO_VERSION = @GLIBMM_MICRO_VERSION@
GLIBMM_MINOR_VERSION = @GLIBMM_MINOR_VERSION@
GLIBMM_RELEASE = @GLIBMM_RELEASE@
GLIBMM_VERSION = @GLIBMM_VERSION@
GREP = @GREP@
GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
GTHREAD_LIBS = @GTHREAD_LIBS@
GTKMMPROC_MERGECDOCS = @GTKMMPROC_MERGECDOCS@
GTKMM_DOXYGEN_INPUT = @GTKMM_DOXYGEN_INPUT@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBGLIBMM_SO_VERSION = @LIBGLIBMM_SO_VERSION@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PERL_PATH = @PERL_PATH@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
files_tools_pm = DocsParser.pm GtkDefs.pm Enum.pm Function.pm FunctionBase.pm Object.pm Output.pm Property.pm Util.pm WrapParser.pm
EXTRA_DIST = Makefile_list_of_sources.am_fragment $(files_tools_pm)
# Install the .pm, files:
tools_pm_includedir = $(libdir)/glibmm-2.4/proc/pm
tools_pm_include_HEADERS = $(files_tools_pm)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/tools/pm/Makefile_list_of_sources.am_fragment $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/pm/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tools/pm/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-tools_pm_includeHEADERS: $(tools_pm_include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(tools_pm_includedir)" || $(MKDIR_P) "$(DESTDIR)$(tools_pm_includedir)"
@list='$(tools_pm_include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(tools_pm_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(tools_pm_includedir)/$$f'"; \
$(tools_pm_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(tools_pm_includedir)/$$f"; \
done
uninstall-tools_pm_includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(tools_pm_include_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(tools_pm_includedir)/$$f'"; \
rm -f "$(DESTDIR)$(tools_pm_includedir)/$$f"; \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS)
installdirs:
for dir in "$(DESTDIR)$(tools_pm_includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-tools_pm_includeHEADERS
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-tools_pm_includeHEADERS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip \
install-tools_pm_includeHEADERS installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am tags uninstall uninstall-am \
uninstall-tools_pm_includeHEADERS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -0,0 +1,2 @@
files_tools_pm = DocsParser.pm GtkDefs.pm Enum.pm Function.pm FunctionBase.pm Object.pm Output.pm Property.pm Util.pm WrapParser.pm

View file

@ -0,0 +1,72 @@
package Object;
use strict;
use warnings;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = ( );
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = ( );
}
our @EXPORT_OK;
# class Object
# {
# string name;
# string module;
# string parent;
# string c_name;
# string gtype_id;
# }
sub new
{
my ($def) = @_;
my $self = {};
bless $self;
$def =~ s/^\(//;
$def =~ s/\)$//;
# snarf down the fields
$$self{name} = $1 if($def =~ s/^define-object (\S+)//);
$$self{module} = $1 if($def =~ s/\(in-module "(\S+)"\)//);
$$self{parent} = $1 if($def =~ s/\(parent "(\S+)"\)//);
$$self{c_name} = $1 if($def =~ s/\(c-name "(\S+)"\)//);
$$self{gtype_id} = $1 if($def =~ s/\(gtype-id "(\S+)"\)//);
if($def !~ /^\s*$/)
{
GtkDefs::error("Unhandled object def ($def) in $$self{module}\::$$self{name}\n")
}
return $self;
}
sub dump($)
{
my ($self) = @_;
print "<object>\n";
foreach(keys %$self)
{ print " <$_ value=\"$$self{$_}\"/>\n"; }
print "</object>\n\n";
}
1; # indicate proper module load.

View file

@ -0,0 +1,954 @@
# Gtkmmproc Output module
#
# Copyright 2001 Free Software Foundation
#
# 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.
#
package Output;
use strict;
BEGIN { @Namespace::ISA=qw(main); }
# $objOutputter new()
sub new
{
my ($m4path, $macrodirs) = @_;
my $self = {};
bless $self;
$$self{out} = [];
$$self{source} = "";
$$self{tmpdir} = "/tmp";
$$self{destdir} = "";
$$self{objDefsParser} = undef; # It will be set in set_defsparser()
$$self{m4path} = $m4path;
$$self{m4args} = "-I";
$$self{m4args} .= join(" -I", @$macrodirs);
return $self;
}
sub set_defsparser($$)
{
my ($self, $objDefsParser) = @_;
$$self{objDefsParser} = $objDefsParser; #Remember it so that we can use it in our output methods.
}
sub m4args_append($$)
{
my ($self, $str) = @_;
$$self{m4args} .= $str;
}
sub append($$)
{
my ($self, $str) = @_;
push(@{$$self{out}}, $str);
}
# void output_wrap_failed($cname, $error)
# Puts a comment in the header about the error during code-generation.
sub output_wrap_failed($$$)
{
my ($self, $cname, $error) = @_;
my $str = sprintf("//gtkmmproc error: %s : %s", $cname, $error);
print STDERR "Output.pm: $cname : $error\n";
$self->append($str);
}
sub error
{
my $format=shift @_;
printf STDERR "Output.pm: $format",@_;
}
sub ifdef($$)
{
my ($self, $ifdef) = @_;
if ($ifdef)
{
$self->append("\n#ifdef $ifdef\n");
}
}
sub endif($$)
{
my ($self, $ifdef) = @_;
if ($ifdef)
{
$self->append("\n#endif // $ifdef\n");
}
}
### Convert _WRAP to a virtual
# _VFUNC_H(signame,rettype,`<cppargs>')
# _VFUNC_PH(gtkname,crettype,cargs and names)
# void output_wrap_vfunc_h($filename, $line_num, $objCppfunc, $objCDefsFunc)
sub output_wrap_vfunc_h($$$$$$)
{
my ($self, $filename, $line_num, $objCppfunc, $objCDefsFunc, $ifdef) = @_;
#Old code. We removed _VFUNC_H from the .m4 file
# my $str = sprintf("_VFUNC_H(%s,%s,\`%s\',%s)dnl\n",
# $$objCppfunc{name},
# $$objCppfunc{rettype},
# $objCppfunc->args_types_and_names(),
# $objCppfunc->get_is_const()
# );
# $self->append($str);
my $cppVfuncDecl = "virtual " . $$objCppfunc{rettype} . " " . $$objCppfunc{name} . "(" . $objCppfunc->args_types_and_names() . ")";
if($objCppfunc->get_is_const())
{
$cppVfuncDecl .= " const";
}
$self->append("#ifdef GLIBMM_VFUNCS_ENABLED\n");
$self->ifdef($ifdef);
$self->append(" $cppVfuncDecl;\n");
$self->endif($ifdef);
$self->append("#endif //GLIBMM_VFUNCS_ENABLED\n");
#The default callback, which will call *_vfunc, which will then call the base default callback.
#Declares the callback in the private *Class class and sets it in the class_init function.
my $str = sprintf("_VFUNC_PH(%s,%s,\`%s\',%s)dnl\n",
$$objCDefsFunc{name},
$$objCDefsFunc{rettype},
$objCDefsFunc->args_types_and_names(),
$ifdef
);
$self->append($str);
}
# _VFUNC_CC(signame,gtkname,rettype,crettype,`<cppargs>',`<cargs>')
sub output_wrap_vfunc_cc($$$$$$$)
{
my ($self, $filename, $line_num, $objCppfunc, $objDefsSignal, $ifdef) = @_;
my $cname = $$objDefsSignal{name};
# e.g. Gtk::Button::draw_indicator:
#Use a different macro for Interfaces, to generate an extra convenience method.
my $refreturn = "";
$refreturn = "refreturn" if($$objCppfunc{rettype_needs_ref});
my $str = sprintf("_VFUNC_CC(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s)dnl\n",
$$objCppfunc{name},
$cname,
$$objCppfunc{rettype},
$$objDefsSignal{rettype},
$objCppfunc->args_types_and_names(),
convert_args_cpp_to_c($objCppfunc, $objDefsSignal, 0, $line_num), #$objCppfunc->args_names_only(),
$objCppfunc->get_is_const(),
$refreturn,
$ifdef);
$self->append($str);
# e.g. Gtk::ButtonClass::draw_indicator():
my $refreturn_ctype = "";
$refreturn_ctype = "refreturn_ctype" if($$objDefsSignal{rettype_needs_ref});
my $str = sprintf("_VFUNC_PCC(%s,%s,%s,%s,\`%s\',\`%s\',\`%s\',%s,%s,%s)dnl\n",
$$objCppfunc{name},
$cname,
$$objCppfunc{rettype},
$$objDefsSignal{rettype},
$objDefsSignal->args_types_and_names(),
$objDefsSignal->args_names_only(),
convert_args_c_to_cpp($objDefsSignal, $objCppfunc, $line_num),
${$objDefsSignal->get_param_names()}[0],
$refreturn_ctype,
$ifdef);
$self->append($str);
}
### Convert _WRAP to a virtual
# _SIGNAL_H(signame,rettype, ifdef, `<cppargs>')
# _SIGNAL_PH(gtkname,crettype, ifdef, cargs and names)
# void output_wrap_default_signal_handler_h($filename, $line_num, $objCppfunc, $objCDefsFunc, $ifdef. @args)
sub output_wrap_default_signal_handler_h($$$$$$$)
{
my ($self, $filename, $line_num, $objCppfunc, $objCDefsFunc, $ifdef) = @_;
my $str = sprintf("_SIGNAL_H(%s,%s,\`%s\',%s)dnl\n",
$$objCppfunc{name},
$$objCppfunc{rettype},
$objCppfunc->args_types_and_names(),
$ifdef
);
$self->append($str);
#The default callback, which will call *_impl, which will then call the base default callback.
#Declares the callback in the private *Class class and sets it in the class_init function.
$str = sprintf("_SIGNAL_PH(%s,%s,\`%s\',%s)dnl\n",
$$objCDefsFunc{name},
$$objCDefsFunc{rettype},
$objCDefsFunc->args_types_and_names(),
$ifdef
);
$self->append($str);
}
# _SIGNAL_CC(signame, gtkname, rettype, crettype,`<cppargs>',`<cargs>')
sub output_wrap_default_signal_handler_cc($$$$$$$$$)
{
my ($self, $filename, $line_num, $objCppfunc, $objDefsSignal, $bImplement, $bCustomCCallback, $bRefreturn, $ifdef) = @_;
my $cname = $$objDefsSignal{name};
# $cname = $1 if ($args[3] =~ /"(.*)"/); #TODO: What's this about?
# e.g. Gtk::Button::on_clicked:
if($bImplement eq 1)
{
my $refreturn = "";
$refreturn = "refreturn" if($bRefreturn eq 1);
my $str = sprintf("_SIGNAL_CC(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s)dnl\n",
$$objCppfunc{name},
$cname,
$$objCppfunc{rettype},
$$objDefsSignal{rettype},
$objCppfunc->args_types_and_names(),
convert_args_cpp_to_c($objCppfunc, $objDefsSignal, 0, $line_num), #$objCppfunc->args_names_only(),
$$objCppfunc{const},
$refreturn,
$ifdef);
$self->append($str);
}
# e.g. Gtk::ButtonClass::on_clicked():
#Callbacks always take the object instance as the first argument:
# my $arglist_names = "object";
# my $arglist_names_extra = $objDefsSignal->args_names_only();
# if ($arglist_names_extra)
# {
# $arglist_names .= ", ";
# $arglist_names .= $arglist_names_extra;
# }
if($bCustomCCallback ne 1)
{
my $str = sprintf("_SIGNAL_PCC(%s,%s,%s,%s,\`%s\',\`%s\',\`%s\',\`%s\',%s)dnl\n",
$$objCppfunc{name},
$cname,
$$objCppfunc{rettype},
$$objDefsSignal{rettype},
$objDefsSignal->args_types_and_names(),
$objDefsSignal->args_names_only(),
convert_args_c_to_cpp($objDefsSignal, $objCppfunc, $line_num),
${$objDefsSignal->get_param_names()}[0],
$ifdef);
$self->append($str);
}
}
### Convert _WRAP to a method
# _METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,const)
# void output_wrap_meth($filename, $line_num, $objCppFunc, $objCDefsFunc, $cppMethodDecl, $documentation, $ifdef)
sub output_wrap_meth($$$$$$$)
{
my ($self, $filename, $line_num, $objCppfunc, $objCDefsFunc, $cppMethodDecl, $documentation, $ifdef) = @_;
my $objDefsParser = $$self{objDefsParser};
# Allow the generated .h/.cc code to have an #ifndef around it, and add deprecation docs to the generated documentation.
my $deprecated = "";
if($$objCDefsFunc{deprecated})
{
$deprecated = "deprecated";
}
#Declaration:
if($deprecated ne "")
{
$self->append("\n_DEPRECATE_IFDEF_START");
}
# Doxygen documentation before the method declaration:
$self->output_wrap_meth_docs_only($filename, $line_num, $documentation);
$self->ifdef($ifdef);
if($$objCDefsFunc{throw_any_errors})
{
$self->append("#ifdef GLIBMM_EXCEPTIONS_ENABLED\n");
}
$self->append(" ${cppMethodDecl};");
if($$objCDefsFunc{throw_any_errors})
{
$self->append("\n#else\n");
# #Add an error argument, by searching for ) at the end and replacing it:
# my $declWithErrorArg = ${cppMethodDecl};
# $declWithErrorArg =~ s/\)$/, std::auto_ptr<Glib::Error>& error\)/g;
#Recreate the declaration, to remove the default values, which we can't have as well as an error parameter at the end:
my $declWithErrorArg = $$objCppfunc{rettype} . " " . $$objCppfunc{name} . "(" . $objCppfunc->args_types_and_names() . ", std::auto_ptr<Glib::Error>& error)";
if($$objCppfunc{static})
{
$declWithErrorArg = "static " . $declWithErrorArg;
}
if($objCppfunc->get_is_const() eq 1)
{
if($$objCppfunc{static} ne 1) #It can't be const and static at the same time.
{
$declWithErrorArg = $declWithErrorArg . " const";
}
}
#remove any superfluous ,:
$declWithErrorArg =~ s/\(, /\(/g;
$self->append(" ${declWithErrorArg};");
$self->append("\n#endif //GLIBMM_EXCEPTIONS_ENABLED\n");
}
$self->endif($ifdef);
if($deprecated ne "")
{
$self->append("\n_DEPRECATE_IFDEF_END\n");
}
my $refneeded = "";
if($$objCDefsFunc{rettype_needs_ref})
{
$refneeded = "refreturn"
}
my $errthrow = "";
if($$objCDefsFunc{throw_any_errors})
{
$errthrow = "errthrow"
}
my $constversion = ""; #Whether it is just a const overload (so it can reuse code)
if($$objCDefsFunc{constversion})
{
$constversion = "constversion"
}
#Implementation:
my $str;
if ($$objCppfunc{static}) {
$str = sprintf("_STATIC_METHOD(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s,%s)dnl\n",
$$objCppfunc{name},
$$objCDefsFunc{c_name},
$$objCppfunc{rettype},
$objCDefsFunc->get_return_type_for_methods(),
$objCppfunc->args_types_and_names(),
convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, 1, $line_num, $errthrow), #1 means it's static, so it has 'object'.
$refneeded,
$errthrow,
$deprecated,
$ifdef);
} else {
$str = sprintf("_METHOD(%s,%s,%s,%s,\`%s\',\`%s\',%s,%s,%s,%s,%s,\`%s\',%s)dnl\n",
$$objCppfunc{name},
$$objCDefsFunc{c_name},
$$objCppfunc{rettype},
$objCDefsFunc->get_return_type_for_methods(),
$objCppfunc->args_types_and_names(),
convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, 0, $line_num, $errthrow),
$$objCppfunc{const},
$refneeded,
$errthrow,
$deprecated,
$constversion,
$objCppfunc->args_names_only(),
$ifdef
);
}
$self->append($str);
}
### Convert _WRAP to a method
# _METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,const)
# void output_wrap_meth($filename, $line_num, $documentation)
sub output_wrap_meth_docs_only($$$$)
{
my ($self, $filename, $line_num, $documentation) = @_;
my $objDefsParser = $$self{objDefsParser};
# Doxygen documentation before the method declaration:
$self->append("\n${documentation}");
}
### Convert _WRAP_CTOR to a ctor
# _METHOD(cppname,cname,cpprettype,crettype,arglist,cargs,const)
# void output_wrap_ctor($filename, $line_num, $objCppFunc, $objCDefsFunc, $cppMethodDecl)
sub output_wrap_ctor($$$$$)
{
my ($self, $filename, $line_num, $objCppfunc, $objCDefsFunc, $cppMethodDecl) = @_;
my $objDefsParser = $$self{objDefsParser};
#Ctor Declaration:
#TODO: Add explicit.
$self->append("explicit " . $cppMethodDecl . ";");
#Implementation:
my $str = sprintf("_CTOR_IMPL(%s,%s,\`%s\',\`%s\')dnl\n",
$$objCppfunc{name},
$$objCDefsFunc{c_name},
$objCppfunc->args_types_and_names(),
get_ctor_properties($objCppfunc, $objCDefsFunc, $line_num)
);
$self->append($str);
}
sub output_wrap_create($$$)
{
my ($self, $args_type_and_name_with_default_values, $objWrapParser) = @_;
#Re-use Function in a very hacky way, to separate the argument types_and_names.
my $fake_decl = "void fake_func(" . $args_type_and_name_with_default_values . ")";
my $objFunction = &Function::new($fake_decl, $objWrapParser);
my $args_names_only = $objFunction->args_names_only();
my $args_type_and_name_hpp = $objFunction->args_types_and_names_with_default_values();
my $args_type_and_name_cpp = $objFunction->args_types_and_names();
my $str = sprintf("_CREATE_METHOD(\`%s\',\`%s\',\`%s\')dnl\n",
$args_type_and_name_hpp, , $args_type_and_name_cpp, $args_names_only);
$self->append($str)
}
# void output_wrap_sig_decl($filename, $line_num, $objCSignal, $objCppfunc, $signal_name, $bCustomCCallback)
# custom_signalproxy_name is "" when no type conversion is required - a normal templates SignalProxy will be used instead.
sub output_wrap_sig_decl($$$$$$$$)
{
my ($self, $filename, $line_num, $objCSignal, $objCppfunc, $signal_name, $bCustomCCallback, $ifdef, $merge_doxycomment_with_previous) = @_;
# _SIGNAL_PROXY(c_signal_name, c_return_type, `<c_arg_types_and_names>',
# cpp_signal_name, cpp_return_type, `<cpp_arg_types>',`<c_args_to_cpp>',
# refdoc_comment)
my $doxycomment = $objCppfunc->get_refdoc_comment();
# If there was already a previous doxygen comment, we want to merge this
# one with the previous so it is one big comment. If it were two separate
# comments, doxygen would ignore the first one. If
# $merge_doxycomment_with_previous is nonzero, the first comment is
# already open but not yet closed.
if($merge_doxycomment_with_previous)
{
# Strip leading whitespace
$doxycomment =~ s/^\s+//;
# We don't have something to add, so just close the comment.
if($doxycomment eq "")
{
$doxycomment = " */";
}
else
{
# Append the new comment, but remove the first three leading characters
# (which are /**) that mark the beginning of the comment.
$doxycomment = substr($doxycomment, 3);
$doxycomment =~ s/^\s+//;
$doxycomment = " " . $doxycomment;
}
}
my $str = sprintf("_SIGNAL_PROXY(%s,%s,\`%s\',%s,%s,\`%s\',\`%s\',\`%s\',\`%s\',%s)dnl\n",
$signal_name,
$$objCSignal{rettype},
$objCSignal->args_types_and_names_without_object(),
$$objCppfunc{name},
$$objCppfunc{rettype},
$objCppfunc->args_types_only(),
convert_args_c_to_cpp($objCSignal, $objCppfunc, $line_num),
$bCustomCCallback, #When this is true, it will not write the *_callback implementation for you.
$doxycomment,
$ifdef
);
$self->append($str);
}
# void output_wrap_enum($filename, $line_num, $cpp_type, $c_type, $comment, @flags)
sub output_wrap_enum($$$$$$$)
{
my ($self, $filename, $line_num, $cpp_type, $c_type, $comment, @flags) = @_;
my $objEnum = GtkDefs::lookup_enum($c_type);
if(!$objEnum)
{
$self->output_wrap_failed($c_type, "enum defs lookup failed.");
return;
}
$objEnum->beautify_values();
my $no_gtype = "";
my $elements = $objEnum->build_element_list(\@flags, \$no_gtype, " ");
if(!$elements)
{
$self->output_wrap_failed($c_type, "unknown _WRAP_ENUM() flag");
return;
}
my $value_suffix = "Enum";
$value_suffix = "Flags" if($$objEnum{flags});
my $str = sprintf("_ENUM(%s,%s,%s,\`%s\',\`%s\',\`%s\')dnl\n",
$cpp_type,
$c_type,
$value_suffix,
$elements,
$no_gtype,
$comment
);
$self->append($str);
}
# void output_wrap_gerror($filename, $line_num, $cpp_type, $c_enum, $domain, @flags)
sub output_wrap_gerror($$$$$$$)
{
my ($self, $filename, $line_num, $cpp_type, $c_enum, $domain, @flags) = @_;
my $objDefsParser = $$self{objDefsParser};
my $objEnum = GtkDefs::lookup_enum($c_enum);
if(!$objEnum)
{
$self->output_wrap_failed($c_enum, "enum defs lookup failed.");
return;
}
# Shouldn't happen, and if it does, I'd like to know that.
warn if($$objEnum{flags});
$objEnum->beautify_values();
# cut off the module prefix, e.g. GDK_
my $prefix = $domain;
$prefix =~ s/^[^_]+_//;
# Chop off the domain prefix, because we put the enum into the class.
unshift(@flags, "s#^${prefix}_##");
my $no_gtype = "";
my $elements = $objEnum->build_element_list(\@flags, \$no_gtype, " ");
my $str = sprintf("_GERROR(%s,%s,%s,\`%s\',%s)dnl\n",
$cpp_type,
$c_enum,
$domain,
$elements,
$no_gtype
);
$self->append($str);
}
# _PROPERTY_PROXY(name, cpp_type)
# void output_wrap_property($filename, $line_num, $name, $cpp_type)
sub output_wrap_property($$$$$$)
{
my ($self, $filename, $line_num, $name, $cpp_type, $c_class) = @_;
my $objDefsParser = $$self{objDefsParser};
my $objProperty = GtkDefs::lookup_property($c_class, $name);
if($objProperty eq 0) #If the lookup failed:
{
$self->output_wrap_failed($name, "property defs lookup failed.");
}
else
{
# We use a suffix to specify a particular Glib::PropertyProxy* class.
my $proxy_suffix = "";
# Read/Write:
if($objProperty->get_construct_only() eq 1)
{
# construct-only functions can be read, but not written.
$proxy_suffix = "_ReadOnly";
}
elsif($objProperty->get_readable() ne 1)
{
$proxy_suffix = "_WriteOnly";
}
elsif($objProperty->get_writable() ne 1)
{
$proxy_suffix = "_ReadOnly";
}
# Convert - to _ so we can use it in C++ method and variable names:
my $name_underscored = $name;
$name_underscored =~ s/-/_/g;
my $str = sprintf("_PROPERTY_PROXY(%s,%s,%s,%s,%s)dnl\n",
$name,
$name_underscored,
$cpp_type,
$proxy_suffix,
$objProperty->get_docs()
);
$self->append($str);
$self->append("\n");
# If the property is not already read-only, and the property can be read, then add a second const accessor for a read-only propertyproxy:
if( ($proxy_suffix ne "_ReadOnly") && ($objProperty->get_readable()) )
{
my $str = sprintf("_PROPERTY_PROXY(%s,%s,%s,%s,%s)dnl\n",
$name,
$name_underscored,
$cpp_type,
"_ReadOnly",
$objProperty->get_docs()
);
$self->append($str);
}
}
}
# vpod output_temp_g1($filename, $section) e.g. output_temp_g1(button, gtk)
sub output_temp_g1($$)
{
my ($self, $section) = @_;
# Write out *.g1 temporary file
open(FILE, '>', "$$self{tmpdir}/gtkmmproc_$$.g1"); # $$ is the Process ID
print FILE "include(base.m4)dnl\n";
my $module = $section;
my $module_canonical = Util::string_canonical($module); #In case there is a / character in the module.
print FILE "_START($$self{source},$module,$module_canonical)dnl\n";
print FILE join("", @{$$self{out}});
print FILE "_END()\n";
close(FILE);
}
sub make_g2_from_g1($)
{
my ($self) = @_;
# Execute m4 to get *.g2 file:
system("$$self{m4path} $$self{m4args} '$$self{tmpdir}/gtkmmproc_$$.g1' > '$$self{tmpdir}/gtkmmproc_$$.g2'");
return ($? >> 8);
}
# void write_sections_to_files()
# This is where we snip the /tmp/gtkmmproc*.g2 file into sections (,h, .cc, _private.h)
sub write_sections_to_files()
{
my ($self) = @_;
my $fname_h = "$$self{destdir}/$$self{source}.h";
my $fname_ph = "$$self{destdir}/private/$$self{source}_p.h";
my $fname_cc = "$$self{destdir}/$$self{source}.cc";
open(INPUT, '<', "$$self{tmpdir}/gtkmmproc_$$.g2"); # $$ is the process ID.
# open tempory file for each section
open(OUTPUT_H, '>', "$fname_h.tmp");
open(OUTPUT_PH, '>', "$fname_ph.tmp");
open(OUTPUT_CC, '>', "$fname_cc.tmp");
my $oldfh = select(OUTPUT_H);
my $blank = 0;
while(<INPUT>)
{
# section switching
if(/^#S 0/) { select(OUTPUT_H); next; }
if(/^#S 1/) { select(OUTPUT_PH); next; }
if(/^#S 2/) { select(OUTPUT_CC); next; }
# get rid of bogus blank lines
if(/^\s*$/) { ++$blank; } else { $blank = 0; }
next if($blank > 2);
print $_;
}
select($oldfh);
close(INPUT);
close(OUTPUT_H);
close(OUTPUT_PH);
close(OUTPUT_CC);
foreach($fname_h, $fname_ph, $fname_cc)
{
# overwrite the source file only if it has actually changed
system("cmp -s '$_.tmp' '$_' || cp '$_.tmp' '$_' ; rm -f '$_.tmp'");
}
}
sub remove_temp_files($)
{
my ($self) = @_;
system("rm -f \"$$self{tmpdir}/gtkmmproc_$$.g1\"");
system("rm -f \"$$self{tmpdir}/gtkmmproc_$$.g2\"");
}
# procedure for generating CONVERT macros
# $string convert_args_cpp_to_c($objCppfunc, $objCDefsFunc, $static, $wrap_line_number,$automatic_error)
sub convert_args_cpp_to_c($$$$;$)
{
my ($objCppfunc, $objCDefsFunc, $static, $wrap_line_number, $automatic_error) = @_;
$automatic_error = "" unless defined $automatic_error;
my $cpp_param_names = $$objCppfunc{param_names};
my $cpp_param_types = $$objCppfunc{param_types};
my $c_param_types = $$objCDefsFunc{param_types};
my @result;
my $num_c_args_expected = scalar(@{$c_param_types});
if( !($static) ) { $num_c_args_expected--; } #The cpp method will need an Object* paramater at the start.
my $num_cpp_args = scalar(@{$cpp_param_types});
# add implicit last error parameter;
if ( $automatic_error ne "" &&
$num_cpp_args == ($num_c_args_expected - 1) &&
${$c_param_types}[-1] eq "GError**" )
{
$num_cpp_args++;
$cpp_param_names = [@{$cpp_param_names},"gerror"];
$cpp_param_types = [@{$cpp_param_types},"GError*&"];
}
if ( $num_cpp_args != $num_c_args_expected )
{
Output::error( "convert_args_cpp_to_c(): Incorrect number of arguments. (%d != %d)\n",
$num_cpp_args,
$num_c_args_expected );
$objCppfunc->dump();
$objCDefsFunc->dump();
return "";
}
# Loop through the cpp parameters:
my $i;
my $cpp_param_max = $num_cpp_args;
# if( !($static) ) { $cpp_param_max++; }
for ($i = 0; $i < $cpp_param_max; $i++)
{
#index of C parameter:
my $iCParam = $i;
if( !($static) ) { $iCParam++; }
my $cppParamType = $$cpp_param_types[$i];
$cppParamType =~ s/ &/&/g; #Remove space between type and &
$cppParamType =~ s/ \*/*/g; #Remove space between type and *
my $cppParamName = $$cpp_param_names[$i];
my $cParamType = $$c_param_types[$iCParam];
if ($cppParamType ne $cParamType) #If a type conversion is needed.
{
push(@result, sprintf("_CONVERT(%s,%s,%s,%s)",
$cppParamType,
$cParamType,
$cppParamName,
$wrap_line_number) );
}
else
{
push(@result, $cppParamName);
}
}
return join(", ", @result);
}
# procedure for generating CONVERT macros
# Ignores the first C 'self' argument.
# $string convert_args_c_to_cpp($objCDefsFunc, $objCppFunc, $wrap_line_number)
sub convert_args_c_to_cpp($$$)
{
my ($objCDefsFunc, $objCppfunc, $wrap_line_number) = @_;
my $cpp_param_types = $$objCppfunc{param_types};
my $c_param_types = $$objCDefsFunc{param_types};
my $c_param_names = $$objCDefsFunc{param_names};
my @result;
my $num_c_args = scalar(@{$c_param_types});
my $num_cpp_args = scalar(@{$cpp_param_types});
if ( ($num_cpp_args + 1) != $num_c_args )
{
Output::error( "convert_args_c_to_cpp(): Incorrect number of arguments. (%d != %d)\n",
$num_cpp_args + 1,
$num_c_args);
$objCppfunc->dump();
$objCDefsFunc->dump();
return "";
}
# Loop through the c parameters:
my $i;
my $c_param_max = $num_c_args;
for ($i = 1; $i < $c_param_max; $i++)
{
#index of C parameter:
my $iCppParam = $i - 1;
my $cppParamType = $$cpp_param_types[$iCppParam];
$cppParamType =~ s/ &/&/g; #Remove space between type and &.
$cppParamType =~ s/ \*/*/g; #Remove space between type and *
my $cParamName = $$c_param_names[$i];
my $cParamType = $$c_param_types[$i];
if ($cParamType ne $cppParamType) #If a type conversion is needed.
{
push(@result, sprintf("_CONVERT(%s,%s,%s,%s)\n",
$cParamType,
$cppParamType,
$cParamName,
$wrap_line_number) );
}
else
{
push(@result, $cParamName);
}
}
return join(", ",@result);
}
# generates the XXX in g_object_new(get_type(), XXX): A list of property names and values.
# Uses the cpp arg name as the property name.
# $string get_ctor_properties($objCppfunc, $objCDefsFunc, $wrap_line_number)
sub get_ctor_properties($$$$)
{
my ($objCppfunc, $objCDefsFunc, $wrap_line_number) = @_;
my $cpp_param_names = $$objCppfunc{param_names};
my $cpp_param_types = $$objCppfunc{param_types};
my $c_param_types = $$objCDefsFunc{param_types};
my @result;
my $num_args = scalar(@{$c_param_types});
my $num_cpp_args = scalar(@{$cpp_param_types});
if ( $num_cpp_args != $num_args )
{
Output::error("get_ctor_properties(): Incorrect number of arguments. (%d != %d)\n",
$num_cpp_args,
$num_args );
return "";
}
# Loop through the cpp parameters:
my $i = 0;
for ($i = 0; $i < $num_args; $i++)
{
my $cppParamType = $$cpp_param_types[$i];
$cppParamType =~ s/ &/&/g; #Remove space between type and &
$cppParamType =~ s/ \*/*/g; #Remove space between type and *
my $cppParamName = $$cpp_param_names[$i];
my $cParamType = $$c_param_types[$i];
# Property name:
push(@result, "\"" . $cppParamName . "\"");
# C property value:
if ($cppParamType ne $cParamType) #If a type conversion is needed.
{
push(@result, sprintf("_CONVERT(%s,%s,%s,%s)",
$cppParamType,
$cParamType,
$cppParamName,
$wrap_line_number) );
}
else
{
push(@result, $cppParamName);
}
}
return join(", ", @result);
}
### Convert _WRAP to a corba method
# _CORBA_METHOD(retype, method_name,args, arg_names_only) - implemented in libbonobomm.
# void output_wrap_corba_method($filename, $line_num, $objCppFunc)
sub output_wrap_corba_method($$$$)
{
my ($self, $filename, $line_num, $objCppfunc) = @_;
my $str = sprintf("_CORBA_METHOD(%s,%s,\`%s\',\`%s\')dnl\n",
$$objCppfunc{rettype},
$$objCppfunc{name},
$objCppfunc->args_types_and_names(),
$objCppfunc->args_names_only()
);
$self->append($str);
}
sub output_implements_interface($$)
{
my ($self, $interface, $ifdef) = @_;
my $str = sprintf("_IMPLEMENTS_INTERFACE_CC(%s, %s)dnl\n",
$interface,
$ifdef);
$self->append($str);
}
1; # indicate proper module load.

View file

@ -0,0 +1,119 @@
package Property;
use strict;
use warnings;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(&func1 &func2 &func4);
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw($Var1 %Hashit &func3);
}
our @EXPORT_OK;
# class Property
# {
# string name;
# string class;
# string type;
# bool readable;
# bool writable;
# bool construct_only;
# string docs;
# }
sub new
{
my ($def) = @_;
my $self = {};
bless $self;
$def=~s/^\(//;
$def=~s/\)$//;
# snarf down the fields
$$self{mark} = 0;
$$self{name} = $1 if ($def =~ s/^define-property (\S+)//);
$$self{class} = $1 if ($def =~ s/\(of-object "(\S+)"\)//);
$$self{type} = $1 if ($def =~ s/\(prop-type "(\S+)"\)//);
$$self{readable} = ($1 eq "#t") if ($def =~ s/\(readable (\S+)\)//);
$$self{writable} = ($1 eq "#t") if ($def =~ s/\(writable (\S+)\)//);
$$self{construct_only} = ($1 eq "#t") if ($def =~ s/\(construct-only (\S+)\)//);
# Property documentation:
my $propertydocs = $1 if ($def =~ s/\(docs "([^"]*)"\)//);
# Add a full-stop if there is not one already:
if(defined($propertydocs))
{
my $docslen = length($propertydocs);
if($docslen)
{
if( !(substr($propertydocs, $docslen - 1, 1) eq ".") )
{
$propertydocs = $propertydocs . ".";
}
}
}
$$self{docs} = $propertydocs;
$$self{name} =~ s/-/_/g; # change - to _
GtkDefs::error("Unhandled property def ($def) in $$self{class}\::$$self{name}\n")
if ($def !~ /^\s*$/);
return $self;
}
sub dump($)
{
my ($self) = @_;
print "<property>\n";
foreach (keys %$self)
{ print " <$_ value=\"$$self{$_}\"/>\n"; }
print "</property>\n\n";
}
sub get_construct_only($)
{
my ($self) = @_;
return $$self{construct_only};
}
sub get_type($)
{
my ($self) = @_;
return $$self{type};
}
sub get_readable($)
{
my ($self) = @_;
return $$self{readable};
}
sub get_writable($)
{
my ($self) = @_;
return $$self{writable};
}
sub get_docs($)
{
my ($self) = @_;
return $$self{docs};
}
1; # indicate proper module load.

View file

@ -0,0 +1,113 @@
# gtkmm - Util module
#
# Copyright 2001 Free Software Foundation
#
# 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.
#
#
# This file holds basic functions used throughout gtkmmproc modules.
# Functions in this module are exported so there is no need to
# request them by module name.
#
package Util;
use strict;
use warnings;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw(&string_unquote &string_trim &string_canonical
&trace &unique);
%EXPORT_TAGS = ( );
# your exported package globals go here,
# as well as any optionally exported functions
#@EXPORT_OK = qw($Var1 %Hashit &func3);
}
our @EXPORT_OK;
#$ string_unquote($string)
# Removes leading and trailing quotes.
sub string_unquote($)
{
my ($str) = @_;
$str =~ s/^['`"]// ;
$str =~ s/['`"]$// ;
return $str;
}
# $ string_trim($string)
# Removes leading and trailing white space.
sub string_trim($)
{
($_) = @_;
s/^\s+//;
s/\s+$//;
return $_;
}
# $ string_canonical($string)
# Convert - to _.
sub string_canonical($)
{
($_) = @_;
s/-/_/g ; # g means 'replace all'
s/\//_/g ; # g means 'replace all'
return $_;
}
#
# Back tracing utility.
# Prints the call stack.
#
# void trace()
sub trace()
{
my ($package, $filename, $line, $subroutine, $hasargs,
$wantarray, $evaltext, $is_require, $hints, $bitmask) = caller(1);
no warnings qw(uninitialized);
my $i = 2;
print "Trace on ${subroutine} called from ${filename}:${line}\n";
while (1)
{
($package, $filename, $line, $subroutine) = caller($i);
$i++;
next if ($line eq "");
print " From ${subroutine} call from ${filename}:${line}\n";
}
}
sub unique(@)
{
my %hash;
foreach (@_)
{
$hash{$_}=1;
}
return keys %hash;
}
1; # indicate proper module load.

File diff suppressed because it is too large Load diff