1
0
mirror of https://github.com/haiwen/libsearpc.git synced 2025-09-12 12:59:30 +00:00

add all files

This commit is contained in:
lins05
2011-04-08 20:58:15 +08:00
parent a4017c7c3e
commit 13d68a1c86
41 changed files with 41778 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
*~
*.pyc
*.o
*.lo
*.la
*.defs
*.log
.deps
*.db
*.tar.gz
autom4te.cache/*

40
Makefile.am Normal file
View File

@@ -0,0 +1,40 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = README rpc_table.py gen-dfun-macro.py
SUBDIRS = tests . pysearpc
AM_CFLAGS = @GLIB2_CFLAGS@ @GOBJECT_CFLAGS@ \
-I$(top_srcdir)/include -I$(top_srcdir)/include/ccnet \
-I$(top_builddir)/include \
@JSON_GLIB_CFLAGS@
noinst_PROGRAMS = searpc-demo-server searpc-demo-client
searpc_demo_server_SOURCES = searpc-demo-server.c searpc-demo-packet.h
searpc_demo_server_LDADD = ./libsearpc.la
searpc_demo_client_SOURCES = searpc-demo-client.c searpc-demo-packet.h
searpc_demo_client_LDADD = ./libsearpc.la
# we need to generate the headers first
BUILT_SOURCES = genrpc
pkglib_LTLIBRARIES = libsearpc.la
include_HEADERS = searpc-client.h searpc-server.h searpc-utils.h
libsearpc_la_SOURCES = searpc-client.c searpc-server.c
libsearpc_la_LDFLAGS = -Wl,-z -Wl,defs
libsearpc_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ \
@JSON_GLIB_LIBS@
genrpc: gen-dfun-macro.py
python gen-dfun-macro.py gen-fcall > fcall-impr.h
python gen-dfun-macro.py gen-fcall-declare > searpc-fcall.h
python gen-dfun-macro.py gen-dfun-macro > searpc-dfun.h
python gen-dfun-macro.py gen-signature > searpc-signature.h
python gen-dfun-macro.py gen-marshal > searpc-marshal.h

934
Makefile.in Normal file
View File

@@ -0,0 +1,934 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@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 = searpc-demo-server$(EXEEXT) \
searpc-demo-client$(EXEEXT)
subdir = .
DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure config.guess \
config.sub depcomp install-sh ltmain.sh missing py-compile
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_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 = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(includedir)"
LTLIBRARIES = $(pkglib_LTLIBRARIES)
libsearpc_la_DEPENDENCIES =
am_libsearpc_la_OBJECTS = searpc-client.lo searpc-server.lo
libsearpc_la_OBJECTS = $(am_libsearpc_la_OBJECTS)
libsearpc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libsearpc_la_LDFLAGS) $(LDFLAGS) -o $@
PROGRAMS = $(noinst_PROGRAMS)
am_searpc_demo_client_OBJECTS = searpc-demo-client.$(OBJEXT)
searpc_demo_client_OBJECTS = $(am_searpc_demo_client_OBJECTS)
searpc_demo_client_DEPENDENCIES = ./libsearpc.la
am_searpc_demo_server_OBJECTS = searpc-demo-server.$(OBJEXT)
searpc_demo_server_OBJECTS = $(am_searpc_demo_server_OBJECTS)
searpc_demo_server_DEPENDENCIES = ./libsearpc.la
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
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 = $(libsearpc_la_SOURCES) $(searpc_demo_client_SOURCES) \
$(searpc_demo_server_SOURCES)
DIST_SOURCES = $(libsearpc_la_SOURCES) $(searpc_demo_client_SOURCES) \
$(searpc_demo_server_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
HEADERS = $(include_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
sed_rest='s,^[^/]*/*,,'; \
sed_last='s,^.*/\([^/]*\)$$,\1,'; \
sed_butlast='s,/*[^/]*$$,,'; \
while test -n "$$dir1"; do \
first=`echo "$$dir1" | sed -e "$$sed_first"`; \
if test "$$first" != "."; then \
if test "$$first" = ".."; then \
dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
else \
first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
if test "$$first2" = "$$first"; then \
dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
else \
dir2="../$$dir2"; \
fi; \
dir0="$$dir0"/"$$first"; \
fi; \
fi; \
dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
done; \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GLIB2_CFLAGS = @GLIB2_CFLAGS@
GLIB2_LIBS = @GLIB2_LIBS@
GOBJECT_CFLAGS = @GOBJECT_CFLAGS@
GOBJECT_LIBS = @GOBJECT_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@
JSON_GLIB_LIBS = @JSON_GLIB_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PYGOBJECT_CFLAGS = @PYGOBJECT_CFLAGS@
PYGOBJECT_LIBS = @PYGOBJECT_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
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_DUMPBIN = @ac_ct_DUMPBIN@
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@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = README rpc_table.py gen-dfun-macro.py
SUBDIRS = tests . pysearpc
AM_CFLAGS = @GLIB2_CFLAGS@ @GOBJECT_CFLAGS@ \
-I$(top_srcdir)/include -I$(top_srcdir)/include/ccnet \
-I$(top_builddir)/include \
@JSON_GLIB_CFLAGS@
searpc_demo_server_SOURCES = searpc-demo-server.c searpc-demo-packet.h
searpc_demo_server_LDADD = ./libsearpc.la
searpc_demo_client_SOURCES = searpc-demo-client.c searpc-demo-packet.h
searpc_demo_client_LDADD = ./libsearpc.la
# we need to generate the headers first
BUILT_SOURCES = genrpc
pkglib_LTLIBRARIES = libsearpc.la
include_HEADERS = searpc-client.h searpc-server.h searpc-utils.h
libsearpc_la_SOURCES = searpc-client.c searpc-server.c
libsearpc_la_LDFLAGS = -Wl,-z -Wl,defs
libsearpc_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ \
@JSON_GLIB_LIBS@
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
install-pkglibLTLIBRARIES: $(pkglib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)"
@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkglibdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkglibdir)"; \
}
uninstall-pkglibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(pkglib_LTLIBRARIES)'; test -n "$(pkglibdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkglibdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkglibdir)/$$f"; \
done
clean-pkglibLTLIBRARIES:
-test -z "$(pkglib_LTLIBRARIES)" || rm -f $(pkglib_LTLIBRARIES)
@list='$(pkglib_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
libsearpc.la: $(libsearpc_la_OBJECTS) $(libsearpc_la_DEPENDENCIES)
$(libsearpc_la_LINK) -rpath $(pkglibdir) $(libsearpc_la_OBJECTS) $(libsearpc_la_LIBADD) $(LIBS)
clean-noinstPROGRAMS:
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
searpc-demo-client$(EXEEXT): $(searpc_demo_client_OBJECTS) $(searpc_demo_client_DEPENDENCIES)
@rm -f searpc-demo-client$(EXEEXT)
$(LINK) $(searpc_demo_client_OBJECTS) $(searpc_demo_client_LDADD) $(LIBS)
searpc-demo-server$(EXEEXT): $(searpc_demo_server_OBJECTS) $(searpc_demo_server_DEPENDENCIES)
@rm -f searpc-demo-server$(EXEEXT)
$(LINK) $(searpc_demo_server_OBJECTS) $(searpc_demo_server_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/searpc-client.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/searpc-demo-client.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/searpc-demo-server.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/searpc-server.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool config.lt
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(includedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(includedir)" && rm -f $$files
# 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):
@fail= 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; \
($(am__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):
@fail= 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; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
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 || \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.h.in $(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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d "$(distdir)" || mkdir "$(distdir)"
@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 "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$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; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
dir1=$$subdir; dir2="$(top_distdir)"; \
$(am__relativize); \
new_top_distdir=$$reldir; \
echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$new_top_distdir" \
distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
done
-test -n "$(am__skip_mode_fix)" \
|| find "$(distdir)" -type d ! -perm -755 \
-exec chmod u+rwx,go+rx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(includedir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) 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)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-recursive
clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
clean-pkglibLTLIBRARIES mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
html-am:
info: info-recursive
info-am:
install-data-am: install-includeHEADERS
install-dvi: install-dvi-recursive
install-dvi-am:
install-exec-am: install-pkglibLTLIBRARIES
install-html: install-html-recursive
install-html-am:
install-info: install-info-recursive
install-info-am:
install-man:
install-pdf: install-pdf-recursive
install-pdf-am:
install-ps: install-ps-recursive
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-pkglibLTLIBRARIES
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
ctags-recursive install install-am install-strip \
tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libtool clean-noinstPROGRAMS clean-pkglibLTLIBRARIES \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-lzma dist-shar dist-tarZ dist-xz dist-zip distcheck \
distclean distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck 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-includeHEADERS install-info \
install-info-am install-man install-pdf install-pdf-am \
install-pkglibLTLIBRARIES install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
installdirs-am maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-compile mostlyclean-generic \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-am uninstall-includeHEADERS \
uninstall-pkglibLTLIBRARIES
genrpc: gen-dfun-macro.py
python gen-dfun-macro.py gen-fcall > fcall-impr.h
python gen-dfun-macro.py gen-fcall-declare > searpc-fcall.h
python gen-dfun-macro.py gen-dfun-macro > searpc-dfun.h
python gen-dfun-macro.py gen-signature > searpc-signature.h
python gen-dfun-macro.py gen-marshal > searpc-marshal.h
# 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:

9297
aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

1502
config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

102
config.h.in Executable file
View File

@@ -0,0 +1,102 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <arpa/inet.h> header file. */
#undef HAVE_ARPA_INET_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the <netinet/in.h> header file. */
#undef HAVE_NETINET_IN_H
/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strndup' function. */
#undef HAVE_STRNDUP
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define to the type of an unsigned integer type of width exactly 16 bits if
such a type exists and the standard includes do not define it. */
#undef uint16_t

1714
config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

13744
configure vendored Executable file

File diff suppressed because it is too large Load Diff

55
configure.ac Normal file
View File

@@ -0,0 +1,55 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([libsearpc], [1.0], [freeplant@gmail.com])
AC_CONFIG_SRCDIR([searpc-server.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 foreign])
# Checks for programs.
AC_PROG_CC
AC_PROG_LIBTOOL
AM_PATH_PYTHON([2.4])
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
# Checks for library functions.
AC_CHECK_FUNCS([memset socket strerror strndup])
# glib and json-glib
GLIB_REQUIRED=2.16.0
JSON_GLIB_REQUIRED=0.10.2
PYGOBJECT_REQUIRED=2.0
PKG_CHECK_MODULES(GLIB2, [glib-2.0 >= $GLIB_REQUIRED])
AC_SUBST(GLIB2_CFLAGS)
AC_SUBST(GLIB2_LIBS)
PKG_CHECK_MODULES(GOBJECT, [gobject-2.0 >= $GLIB_REQUIRED])
AC_SUBST(GOBJECT_CFLAGS)
AC_SUBST(GOBJECT_LIBS)
PKG_CHECK_MODULES(JSON_GLIB, [json-glib-1.0 >= $JSON_GLIB_REQUIRED])
AC_SUBST(JSON_GLIB_CFLAGS)
AC_SUBST(JSON_GLIB_LIBS)
PKG_CHECK_MODULES(PYGOBJECT, [pygobject-2.0 >= $PYGOBJECT_REQUIRED])
AC_SUBST(PYGOBJECT_CFLAGS)
AC_SUBST(PYGOBJECT_LIBS)
AC_CONFIG_FILES([Makefile
pysearpc/Makefile
tests/Makefile])
AC_OUTPUT

630
depcomp Executable file
View File

@@ -0,0 +1,630 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
# Software Foundation, Inc.
# 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u="sed s,\\\\\\\\,/,g"
depmode=msvisualcpp
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no eat=no
for arg
do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" "
for arg
do
case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvcmsys)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

111
fcall-impr.h Normal file
View File

@@ -0,0 +1,111 @@
char*
searpc_client_fcall__string (const char* fname, const gchar* param1, gsize *len)
{
JsonArray *array;
g_return_val_if_fail (fname != NULL, NULL);
array = json_array_new ();
json_array_add_string_element (array, fname);
json_array_add_string_or_null_element (array, param1);
return fcall_common(array, len);
}
char*
searpc_client_fcall__string_string (const char* fname, const gchar* param1, const gchar* param2, gsize *len)
{
JsonArray *array;
g_return_val_if_fail (fname != NULL, NULL);
array = json_array_new ();
json_array_add_string_element (array, fname);
json_array_add_string_or_null_element (array, param1);
json_array_add_string_or_null_element (array, param2);
return fcall_common(array, len);
}
char*
searpc_client_fcall__void (const char* fname, gsize *len)
{
JsonArray *array;
g_return_val_if_fail (fname != NULL, NULL);
array = json_array_new ();
json_array_add_string_element (array, fname);
return fcall_common(array, len);
}
char*
searpc_client_fcall__string_int (const char* fname, const gchar* param1, int param2, gsize *len)
{
JsonArray *array;
g_return_val_if_fail (fname != NULL, NULL);
array = json_array_new ();
json_array_add_string_element (array, fname);
json_array_add_string_or_null_element (array, param1);
json_array_add_int_element (array, param2);
return fcall_common(array, len);
}
char*
searpc_client_fcall__int_int (const char* fname, int param1, int param2, gsize *len)
{
JsonArray *array;
g_return_val_if_fail (fname != NULL, NULL);
array = json_array_new ();
json_array_add_string_element (array, fname);
json_array_add_int_element (array, param1);
json_array_add_int_element (array, param2);
return fcall_common(array, len);
}
char*
searpc_client_fcall__string_int_int (const char* fname, const gchar* param1, int param2, int param3, gsize *len)
{
JsonArray *array;
g_return_val_if_fail (fname != NULL, NULL);
array = json_array_new ();
json_array_add_string_element (array, fname);
json_array_add_string_or_null_element (array, param1);
json_array_add_int_element (array, param2);
json_array_add_int_element (array, param3);
return fcall_common(array, len);
}
char*
searpc_client_fcall__string_string_int (const char* fname, const gchar* param1, const gchar* param2, int param3, gsize *len)
{
JsonArray *array;
g_return_val_if_fail (fname != NULL, NULL);
array = json_array_new ();
json_array_add_string_element (array, fname);
json_array_add_string_or_null_element (array, param1);
json_array_add_string_or_null_element (array, param2);
json_array_add_int_element (array, param3);
return fcall_common(array, len);
}

344
gen-dfun-macro.py Normal file
View File

@@ -0,0 +1,344 @@
#!/usr/bin/python
"""
Generate function define macros.
"""
import string
import sys
# type -> (<c type if used as parameter>, <c type if used as ret type>,
# <function to get value from array>,
# <function to set value to the ret_object>,
# <function to set value to array>,
# <default_ret_value>)
type_table = {
"string": ("const gchar*",
"gchar*",
"json_array_get_string_or_null_element",
"set_string_to_ret_object",
"json_array_add_string_or_null_element",
"NULL"),
"int": ("int",
"int",
"json_array_get_int_element",
"set_int_to_ret_object",
"json_array_add_int_element",
"-1"),
"object": ("GObject*",
"GObject*",
"",
"set_object_to_ret_object",
"",
"NULL"),
"objlist": ("GList*",
"GList*",
"",
"set_objlist_to_ret_object",
"",
"NULL"),
}
marshal_template = r"""
static gchar *
${marshal_name} (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
${get_parameters}
${func_call}
JsonObject *object = json_object_new ();
${convert_ret}
return marshal_set_ret_common (object, ret_len, error);
}
"""
def generate_marshal(ret_type, arg_types):
ret_type_item = type_table[ret_type]
ret_type_in_c = ret_type_item[1]
template = string.Template(marshal_template)
if len(arg_types) == 0:
marshal_name = "marshal_" + ret_type + "__void"
else:
marshal_name = "marshal_" + ret_type + "__" + ('_'.join(arg_types))
get_parameters = ""
for i, arg_type in enumerate(arg_types):
type_item = type_table[arg_type]
stmt = " %s param%d = %s (param_array, %d);\n" %(
type_item[0], i+1, type_item[2], i+1)
get_parameters += stmt
# func_prototype should be something like
# GList* (*)(const char*, int, GError **)
func_prototype = ret_type_in_c + " (*)("
for arg_type in arg_types:
func_prototype += type_table[arg_type][0] + ", "
func_prototype += "GError **)"
func_args = ""
for i in range(1, len(arg_types)+1):
func_args += "param%d, " % (i)
func_args += "&error"
func_call = "%s ret = ((%s)func) (%s);" % (ret_type_in_c, func_prototype,
func_args)
convert_ret = "%s (object, ret);" % ret_type_item[3]
return template.substitute(marshal_name=marshal_name,
get_parameters=get_parameters,
func_call=func_call,
convert_ret=convert_ret)
def gen_marshal_functions():
from rpc_table import func_table
for item in func_table:
print generate_marshal(item[0], item[1])
marshal_register_item = r"""
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = ${marshal_name};
item->signature = ${signature_name}();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
"""
def generate_marshal_register_item(ret_type, arg_types):
if len(arg_types) == 0:
marshal_name = "marshal_" + ret_type + "__void"
else:
marshal_name = "marshal_" + ret_type + "__" + ('_'.join(arg_types))
if len(arg_types) == 0:
signature_name = "searpc_signature_" + ret_type + "__void"
else:
signature_name = "searpc_signature_" + ret_type + "__" + (
'_'.join(arg_types))
return string.Template(marshal_register_item).substitute(
marshal_name=marshal_name,
signature_name=signature_name)
def gen_marshal_register_function():
from rpc_table import func_table
print "static void register_marshals(GHashTable *marshal_table)"""
print "{"
for item in func_table:
print generate_marshal_register_item(item[0], item[1]),
print "}"
signature_template = r"""
inline static const gchar *
${signature_name}()
{
return searpc_compute_signature (${args});
}
"""
def generate_signature(ret_type, arg_types):
ret_type_item = type_table[ret_type]
ret_type_in_c = ret_type_item[1]
if len(arg_types) == 0:
signature_name = "searpc_signature_" + ret_type + "__void"
else:
signature_name = "searpc_signature_" + ret_type + "__" + (
'_'.join(arg_types))
args = "\"" + ret_type + "\"" + ", " + str(len(arg_types))
for arg_type in arg_types:
args += ", " + "\"" + arg_type + "\""
template = string.Template(signature_template)
return template.substitute(signature_name=signature_name, args=args)
def gen_signature_list():
from rpc_table import func_table
for item in func_table:
print generate_signature(item[0], item[1])
fcall_template = r"""
char*
searpc_client_fcall__${suffix} (const char* fname, ${args})
{
JsonArray *array;
g_return_val_if_fail (fname != NULL, NULL);
array = json_array_new ();
json_array_add_string_element (array, fname);
${args_to_array}
return fcall_common(array, len);
}
"""
def gen_fcall(arg_types):
if len(arg_types) == 0:
suffix = "void"
args = "gsize *len"
args_to_array = ""
return string.Template(fcall_template).substitute(suffix=suffix,
args=args, args_to_array=args_to_array)
suffix = "_".join(arg_types)
args = ""
args_to_array = ""
for i, arg_type in enumerate(arg_types):
args += type_table[arg_type][0] + " param" + str(i+1) + ", "
args_to_array += " " + type_table[arg_type][4] + " (array, param" + str(i+1) +");\n"
args += "gsize *len"
return string.Template(fcall_template).substitute(suffix=suffix,
args=args, args_to_array=args_to_array)
def gen_fcall_list():
from rpc_table import func_table
arg_types_list = []
for item in func_table:
if item[1] not in arg_types_list:
arg_types_list.append(item[1])
for item in arg_types_list:
print gen_fcall(item)
fcall_declare_template = r"""
char* searpc_client_fcall__${suffix} (const char* fname, ${args});
"""
def gen_fcall_declare(arg_types):
if len(arg_types) == 0:
suffix = "void"
args = "gsize *len"
return string.Template(fcall_declare_template).substitute(suffix=suffix,
args=args)
suffix = "_".join(arg_types)
args = ""
for i, arg_type in enumerate(arg_types):
args += type_table[arg_type][0] + " param" + str(i+1) + ", "
args += "gsize *len"
return string.Template(fcall_declare_template).substitute(suffix=suffix,
args=args)
def gen_fcall_declare_list():
from rpc_table import func_table
arg_types_list = []
for item in func_table:
if item[1] not in arg_types_list:
arg_types_list.append(item[1])
for item in arg_types_list:
print gen_fcall_declare(item)
dfun_template_with_gtype = r"""
#define SEARPC_CLIENT_DEFUN_${RET_TYPE}__${ARG_TYPES}(funcname, gtype) \
${ret_type_in_c} \
funcname (SearpcClient *client, ${args}) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
${ret_type_in_c} result; \
\
fcall = searpc_client_fcall__${arg_types} (#funcname, \
${fcall_args}); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return ${default_value}; \
} \
result = searpc_client_fret__${ret_type} (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
"""
dfun_template_without_gtype = r"""
#define SEARPC_CLIENT_DEFUN_${RET_TYPE}__${ARG_TYPES}(funcname) \
${ret_type_in_c} \
funcname (SearpcClient *client, ${args}) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
${ret_type_in_c} result; \
\
fcall = searpc_client_fcall__${arg_types} (#funcname, \
${fcall_args}); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return ${default_value}; \
} \
result = searpc_client_fret__${ret_type} (fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
"""
def gen_dfun_macro(ret_type, arg_types):
if ret_type in ['object', 'objlist']:
template = string.Template(dfun_template_with_gtype)
else:
template = string.Template(dfun_template_without_gtype)
if len(arg_types) == 0:
arg_types_str = "void"
else:
arg_types_str = "_".join(arg_types)
args = ""
for i, arg_type in enumerate(arg_types):
args += type_table[arg_type][0] + " param" + str(i+1) + ", "
args += "GError **error"
fcall_args = ""
for i, arg_type in enumerate(arg_types):
fcall_args += " param" + str(i+1) + ", "
fcall_args += "&fcall_len"
default_value = type_table[ret_type][5]
ret_type_in_c = type_table[ret_type][1]
return template.substitute(ret_type=ret_type, RET_TYPE=ret_type.upper(),
ret_type_in_c=ret_type_in_c,
arg_types=arg_types_str, ARG_TYPES=arg_types_str.upper(),
args=args, fcall_args=fcall_args,
default_value=default_value)
def gen_dfun_macro_list():
from rpc_table import func_table
for item in func_table:
print gen_dfun_macro(item[0], item[1])
if __name__ == "__main__":
command = sys.argv[1]
if command == "gen-marshal":
gen_marshal_functions()
gen_marshal_register_function()
elif command == "gen-signature":
gen_signature_list()
elif command == "gen-fcall":
gen_fcall_list()
elif command == "gen-fcall-declare":
gen_fcall_declare_list()
elif command == "gen-dfun-macro":
gen_dfun_macro_list()

520
install-sh Executable file
View File

@@ -0,0 +1,520 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

8413
ltmain.sh Executable file

File diff suppressed because it is too large Load Diff

376
missing Executable file
View File

@@ -0,0 +1,376 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
\`g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# normalize program name to check for.
program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program). This is about non-GNU programs, so use $1 not
# $program.
case $1 in
lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

146
py-compile Executable file
View File

@@ -0,0 +1,146 @@
#!/bin/sh
# py-compile - Compile a Python program
scriptversion=2009-04-28.21; # UTC
# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software
# Foundation, Inc.
# 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, 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, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
if [ -z "$PYTHON" ]; then
PYTHON=python
fi
basedir=
destdir=
files=
while test $# -ne 0; do
case "$1" in
--basedir)
basedir=$2
if test -z "$basedir"; then
echo "$0: Missing argument to --basedir." 1>&2
exit 1
fi
shift
;;
--destdir)
destdir=$2
if test -z "$destdir"; then
echo "$0: Missing argument to --destdir." 1>&2
exit 1
fi
shift
;;
-h|--h*)
cat <<\EOF
Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] FILES..."
Byte compile some python scripts FILES. Use --destdir to specify any
leading directory path to the FILES that you don't want to include in the
byte compiled file. Specify --basedir for any additional path information you
do want to be shown in the byte compiled file.
Example:
py-compile --destdir /tmp/pkg-root --basedir /usr/share/test test.py test2.py
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v|--v*)
echo "py-compile $scriptversion"
exit $?
;;
*)
files="$files $1"
;;
esac
shift
done
if test -z "$files"; then
echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
exit 1
fi
# if basedir was given, then it should be prepended to filenames before
# byte compilation.
if [ -z "$basedir" ]; then
pathtrans="path = file"
else
pathtrans="path = os.path.join('$basedir', file)"
fi
# if destdir was given, then it needs to be prepended to the filename to
# byte compile but not go into the compiled file.
if [ -z "$destdir" ]; then
filetrans="filepath = path"
else
filetrans="filepath = os.path.normpath('$destdir' + os.sep + path)"
fi
$PYTHON -c "
import sys, os, py_compile
files = '''$files'''
sys.stdout.write('Byte-compiling python modules...\n')
for file in files.split():
$pathtrans
$filetrans
if not os.path.exists(filepath) or not (len(filepath) >= 3
and filepath[-3:] == '.py'):
continue
sys.stdout.write(file)
sys.stdout.flush()
py_compile.compile(filepath, filepath + 'c', path)
sys.stdout.write('\n')" || exit $?
# this will fail for python < 1.5, but that doesn't matter ...
$PYTHON -O -c "
import sys, os, py_compile
files = '''$files'''
sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
for file in files.split():
$pathtrans
$filetrans
if not os.path.exists(filepath) or not (len(filepath) >= 3
and filepath[-3:] == '.py'):
continue
sys.stdout.write(file)
sys.stdout.flush()
py_compile.compile(filepath, filepath + 'o', path)
sys.stdout.write('\n')" 2>/dev/null || :
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

29
pysearpc/Makefile.am Normal file
View File

@@ -0,0 +1,29 @@
EXTRA_DIST = pysearpc-demo-client.py
AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
-I$(top_srcdir) \
-I$(top_srcdir)/include \
@GLIB2_CFLAGS@ \
@PYGOBJECT_CFLAGS@ \
-I/usr/include/python$(PYTHON_VERSION)
# define the destination to install pysearpc files
pysearpcdir=${pyexecdir}/pysearpc
pysearpc_PYTHON = __init__.py client.py gen-dfun-macro.py
# generating the fcallfret module
pysearpc_LTLIBRARIES = fcallfret.la
fcallfret_la_LDFLAGS = -module -avoid-version -export-symbols-regex initfcallfret
fcallfret_la_SOURCES = fcallfret.c fcallfret.h
fcallfret_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ \
$(top_builddir)/libsearpc.la
CLEANFILES = fcallfret.h
fcallfret.c: gen-dfun-macro.py
python $< gen-searpcclient > fcallfret.h
.PHONY: fcallfret.c

602
pysearpc/Makefile.in Normal file
View File

@@ -0,0 +1,602 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@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@
subdir = pysearpc
DIST_COMMON = $(pysearpc_PYTHON) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_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 = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(pysearpcdir)" \
"$(DESTDIR)$(pysearpcdir)"
LTLIBRARIES = $(pysearpc_LTLIBRARIES)
fcallfret_la_DEPENDENCIES = $(top_builddir)/libsearpc.la
am_fcallfret_la_OBJECTS = fcallfret.lo
fcallfret_la_OBJECTS = $(am_fcallfret_la_OBJECTS)
fcallfret_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(fcallfret_la_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
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 = $(fcallfret_la_SOURCES)
DIST_SOURCES = $(fcallfret_la_SOURCES)
py_compile = $(top_srcdir)/py-compile
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GLIB2_CFLAGS = @GLIB2_CFLAGS@
GLIB2_LIBS = @GLIB2_LIBS@
GOBJECT_CFLAGS = @GOBJECT_CFLAGS@
GOBJECT_LIBS = @GOBJECT_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@
JSON_GLIB_LIBS = @JSON_GLIB_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PYGOBJECT_CFLAGS = @PYGOBJECT_CFLAGS@
PYGOBJECT_LIBS = @PYGOBJECT_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
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_DUMPBIN = @ac_ct_DUMPBIN@
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@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = pysearpc-demo-client.py
AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\" \
-DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
-I$(top_srcdir) \
-I$(top_srcdir)/include \
@GLIB2_CFLAGS@ \
@PYGOBJECT_CFLAGS@ \
-I/usr/include/python$(PYTHON_VERSION)
# define the destination to install pysearpc files
pysearpcdir = ${pyexecdir}/pysearpc
pysearpc_PYTHON = __init__.py client.py gen-dfun-macro.py
# generating the fcallfret module
pysearpc_LTLIBRARIES = fcallfret.la
fcallfret_la_LDFLAGS = -module -avoid-version -export-symbols-regex initfcallfret
fcallfret_la_SOURCES = fcallfret.c fcallfret.h
fcallfret_la_LIBADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ \
$(top_builddir)/libsearpc.la
CLEANFILES = fcallfret.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign pysearpc/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign pysearpc/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: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-pysearpcLTLIBRARIES: $(pysearpc_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(pysearpcdir)" || $(MKDIR_P) "$(DESTDIR)$(pysearpcdir)"
@list='$(pysearpc_LTLIBRARIES)'; test -n "$(pysearpcdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
list2="$$list2 $$p"; \
else :; fi; \
done; \
test -z "$$list2" || { \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pysearpcdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pysearpcdir)"; \
}
uninstall-pysearpcLTLIBRARIES:
@$(NORMAL_UNINSTALL)
@list='$(pysearpc_LTLIBRARIES)'; test -n "$(pysearpcdir)" || list=; \
for p in $$list; do \
$(am__strip_dir) \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pysearpcdir)/$$f'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pysearpcdir)/$$f"; \
done
clean-pysearpcLTLIBRARIES:
-test -z "$(pysearpc_LTLIBRARIES)" || rm -f $(pysearpc_LTLIBRARIES)
@list='$(pysearpc_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
fcallfret.la: $(fcallfret_la_OBJECTS) $(fcallfret_la_DEPENDENCIES)
$(fcallfret_la_LINK) -rpath $(pysearpcdir) $(fcallfret_la_OBJECTS) $(fcallfret_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcallfret.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
install-pysearpcPYTHON: $(pysearpc_PYTHON)
@$(NORMAL_INSTALL)
test -z "$(pysearpcdir)" || $(MKDIR_P) "$(DESTDIR)$(pysearpcdir)"
@list='$(pysearpc_PYTHON)'; dlist=; list2=; test -n "$(pysearpcdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
if test -f $$b$$p; then \
$(am__strip_dir) \
dlist="$$dlist $$f"; \
list2="$$list2 $$b$$p"; \
else :; fi; \
done; \
for file in $$list2; do echo $$file; done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pysearpcdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(pysearpcdir)" || exit $$?; \
done || exit $$?; \
if test -n "$$dlist"; then \
if test -z "$(DESTDIR)"; then \
PYTHON=$(PYTHON) $(py_compile) --basedir "$(pysearpcdir)" $$dlist; \
else \
PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir "$(pysearpcdir)" $$dlist; \
fi; \
else :; fi
uninstall-pysearpcPYTHON:
@$(NORMAL_UNINSTALL)
@list='$(pysearpc_PYTHON)'; test -n "$(pysearpcdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
filesc=`echo "$$files" | sed 's|$$|c|'`; \
fileso=`echo "$$files" | sed 's|$$|o|'`; \
echo " ( cd '$(DESTDIR)$(pysearpcdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pysearpcdir)" && rm -f $$files || exit $$?; \
echo " ( cd '$(DESTDIR)$(pysearpcdir)' && rm -f" $$filesc ")"; \
cd "$(DESTDIR)$(pysearpcdir)" && rm -f $$filesc || exit $$?; \
echo " ( cd '$(DESTDIR)$(pysearpcdir)' && rm -f" $$fileso ")"; \
cd "$(DESTDIR)$(pysearpcdir)" && rm -f $$fileso
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__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 "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$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)
installdirs:
for dir in "$(DESTDIR)$(pysearpcdir)" "$(DESTDIR)$(pysearpcdir)"; 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:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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 clean-pysearpcLTLIBRARIES \
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
html-am:
info: info-am
info-am:
install-data-am: install-pysearpcLTLIBRARIES install-pysearpcPYTHON
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
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-pysearpcLTLIBRARIES uninstall-pysearpcPYTHON
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-pysearpcLTLIBRARIES 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-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-pysearpcLTLIBRARIES install-pysearpcPYTHON \
install-strip 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-pysearpcLTLIBRARIES uninstall-pysearpcPYTHON
fcallfret.c: gen-dfun-macro.py
python $< gen-searpcclient > fcallfret.h
.PHONY: fcallfret.c
# 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:

2
pysearpc/__init__.py Normal file
View File

@@ -0,0 +1,2 @@
from client import SearpcClient, searpc_func, SearpcError

57
pysearpc/client.py Normal file
View File

@@ -0,0 +1,57 @@
import fcallfret
class SearpcError(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return self.msg
def searpc_func(ret_type, param_types, ret_obj_class=None):
"""
ret_obj_class is for ret_type 'object', 'objlist'
"""
def decorate(func):
if len(param_types) == 0:
fcall = getattr(fcallfret, 'fcall__void')
else:
fcall = getattr(fcallfret, 'fcall__' + '_'.join(param_types))
if ret_type == "void":
fret = None
else:
fret = getattr(fcallfret, 'fret__' + ret_type)
def newfunc(self, *args):
fcall_str = fcall(func.__name__, *args)
ret_str = self.call_remote_func_sync(fcall_str)
if fret:
try:
return fret(ret_str)
except fcallfret.error, e:
raise SearpcError(e)
def newfunc_obj(self, *args):
fcall_str = fcall(func.__name__, *args)
ret_str = self.call_remote_func_sync(fcall_str)
if fret:
try:
return fret(ret_obj_class, ret_str)
except fcallfret.error, e:
raise SearpcError(e)
if ret_obj_class:
return newfunc_obj
else:
return newfunc
return decorate
class SearpcClient(object):
def call_remote_func_sync(self, fcall_str):
raise NotImplementedError()

146
pysearpc/fcallfret.c Normal file
View File

@@ -0,0 +1,146 @@
/*
* Copyright (C) 2011 Zheng Liu
*
* 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.
*/
#include <Python.h>
#include <sys/time.h>
#include <sys/types.h>
#include <glib-object.h>
#include <pygobject.h>
#include <../searpc-client.h>
#include <structmember.h>
static PyObject *SearpcError;
static PyObject *
SearpcClient_Fret__Object(PyObject *self, PyObject *args)
{
char *data;
GType type;
PyObject *type_obj;
GObject *res;
GError *error = NULL;
if (!PyArg_ParseTuple(args, "Os", &type_obj, &data))
return NULL;
type = pyg_type_from_object(type_obj);
res = searpc_client_fret__object(type, data, strlen(data), &error);
if (error) {
PyErr_SetString(SearpcError, error->message);
return NULL;
}
return pygobject_new(res);
}
static PyObject *
SearpcClient_Fret__Objlist(PyObject *self, PyObject *args)
{
char *data;
GType type;
PyObject *type_obj, *res, *tmp;
GList *list, *p;
GError *error = NULL;
if (!PyArg_ParseTuple(args, "Os", &type_obj, &data))
return NULL;
type = pyg_type_from_object(type_obj);
list = searpc_client_fret__objlist(type, data, strlen(data), &error);
if (error) {
PyErr_SetString(SearpcError, error->message);
return NULL;
}
res = PyList_New(0);
for (p = list; p; p = p->next) {
tmp = pygobject_new(p->data);
PyList_Append(res, tmp);
}
return res;
}
static PyObject *
SearpcClient_Fret__String(PyObject *self, PyObject *args)
{
char *data;
char *res;
PyObject *ret;
GError *error = NULL;
if (!PyArg_ParseTuple(args, "s", &data))
return NULL;
res = searpc_client_fret__string(data, strlen(data), &error);
if (error) {
PyErr_SetString(SearpcError, error->message);
return NULL;
}
if (res == NULL) {
Py_INCREF(Py_None);
return Py_None;
}
ret = PyString_FromString(res);
g_free (res);
return ret;
}
static PyObject *
SearpcClient_Fret__Int(PyObject *self, PyObject *args)
{
char *data;
int res;
GError *error = NULL;
if (!PyArg_ParseTuple(args, "s", &data))
return NULL;
res = searpc_client_fret__int(data, strlen(data), &error);
if (error) {
PyErr_SetString(SearpcError, error->message);
return NULL;
}
return PyLong_FromLong(res);;
}
#include "fcallfret.h"
DL_EXPORT(void) initfcallfret(void)
{
PyObject *m, *d;
init_pygobject();
m = Py_InitModule("fcallfret", SearpcClientModule_Functions);
d = PyModule_GetDict(m);
SearpcError = PyErr_NewException("pysearpc.error", NULL, NULL);
Py_INCREF(SearpcError);
PyModule_AddObject(m, "error", SearpcError);
}

357
pysearpc/gen-dfun-macro.py Normal file
View File

@@ -0,0 +1,357 @@
#!/usr/bin/python
"""
Generate function define macros.
"""
import string
import sys
sys.path += ['../']
# XXX: generate searpc-client.h file
module_func_array_template = r"""
static PyMethodDef SearpcClientModule_Functions[] = {
${array}
{NULL, NULL, 0, NULL},
};
"""
func_item_template = r"""
{"${pyfuncname}", (PyCFunction)${cfuncname},
METH_VARARGS, "" },"""
def gen_fcall_funcs_array(arg_types):
fcall_array = ""
if len(arg_types) == 0:
pyfuncname = "fcall__void"
cfuncname = "SearpcClient_Fcall__Void"
else:
pyfuncname = "fcall__" + "_".join(arg_types)
tmplist = []
for arg in arg_types:
tmplist.append(string.capitalize(arg))
cfuncname = "SearpcClient_Fcall__" + "_".join(tmplist)
return string.Template(func_item_template)\
.substitute(pyfuncname=pyfuncname,
cfuncname=cfuncname)
def gen_fret_funcs_array(ret_type):
fret_array = ""
if ret_type is None:
pyfuncname = "fret__void"
cfuncname = "SearpcClient_Fret__Void"
else:
pyfuncname = "fret__" + ret_type
cfuncname = "SearpcClient_Fret__" + string.capitalize(ret_type)
return string.Template(func_item_template)\
.substitute(pyfuncname=pyfuncname,
cfuncname=cfuncname)
def gen_module_funcs_array():
from rpc_table import func_table
# generate fcall methods array
fcall_array = ""
arg_types_list = []
for item in func_table:
if item[1] not in arg_types_list:
arg_types_list.append(item[1])
for item in arg_types_list:
fcall_array += gen_fcall_funcs_array(item)
# generate fret methods array
fret_array = ""
ret_types_list = []
for item in func_table:
if item[0] not in ret_types_list:
ret_types_list.append(item[0])
for item in ret_types_list:
fret_array += gen_fret_funcs_array(item)
array = fcall_array
array += fret_array
print string.Template(module_func_array_template)\
.substitute(array=array)
type_table = {
"string" : ("char *", "s"),
"int" : ("int", "i"),
"object" : ("GObject *", "O"),
}
fcall_template = r"""
static PyObject *
SearpcClient_Fcall__${Suffix}(PyObject *self,
PyObject *args)
{
char *fname;
${def_args}
char *fcall;
gsize len;
if (!PyArg_ParseTuple(args, "${fmt}", ${args_addr}))
return NULL;
fcall = searpc_client_fcall__${suffix}(${args});
return PyString_FromString(fcall);
}
"""
def gen_fcall_func(arg_types):
if len(arg_types) == 0:
Suffix = "Void"
suffix = "void"
def_args = ""
kwargs_str = "NULL"
fmt = "s"
args_addr = "&fname"
args = "fname, &len"
return string.Template(fcall_template)\
.substitute(Suffix=Suffix, suffix=suffix,
def_args=def_args, kwargs_str=kwargs_str,
fmt=fmt, args_addr=args_addr, args=args)
tmplist = []
for arg in arg_types:
tmplist.append(string.capitalize(arg))
Suffix = "_".join(tmplist)
suffix = "_".join(arg_types)
def_args = ""
kwargs_str = ""
fmt = "s"
args_addr = "&fname"
args = "fname"
for i, arg_type in enumerate(arg_types):
def_args += " " + type_table[arg_type][0] + " param" + \
str(i + 1) + ";\n"
kwargs_str += '"param' + str(i + 1) + '", '
fmt += type_table[arg_type][1]
args_addr += ", &param" + str(i + 1)
args += ", param" + str(i + 1)
kwargs_str += "NULL"
args += ", &len"
return string.Template(fcall_template)\
.substitute(Suffix=Suffix, suffix=suffix,
def_args=def_args, kwargs_str=kwargs_str,
fmt=fmt, args_addr=args_addr, args=args)
def gen_fcall_list():
from rpc_table import func_table
arg_types_list = []
for item in func_table:
if item[1] not in arg_types_list:
arg_types_list.append(item[1])
for item in arg_types_list:
print gen_fcall_func(item)
ret_table = {
"string" : "PyString_FromString",
"int" : "PyLong_FromLong",
"object" : "pygobject_new",
}
fret_template = r"""
static PyObject *
SearpcClient_Fret__${Suffix}(PyObject *self,
PyObject *args)
{
char *data;
${def_args}
GError *error = NULL;
if (!PyArg_ParseTuple(args, "${fmt}", ${args_addr}))
return NULL;
res = searpc_client_fret__${suffix}(${args}, strlen(data), &error);
return ${ret_func};
}
"""
fret_objlist_template = r"""
static PyObject *SearpcClient_Fret__Objlist(PyObject *self,
PyObject *args)
{
char *data;
GType type;
PyObject *type_obj, *res, *tmp;
GList *list, *p;
GError *error = NULL;
static char *kwlist[] = { "type", "data", NULL };
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Os",
kwlist, &type_obj, &data))
return NULL;
type = pyg_type_from_object(type_obj);
list = searpc_client_fret__objlist(type, data, strlen(data), &error);
res = PyList_New(0);
for (p = list; p; p = p->next) {
tmp = pygobject_new(p->data);
PyList_Append(res, tmp);
}
return res;
}
"""
def gen_fret_func(ret_type):
if ret_type == "objlist":
return fret_objlist_template
Suffix = string.capitalize(ret_type)
suffix = ret_type
def_args = ""
kwargs_str = ""
fmt = ""
args_addr = ""
args = ""
if ret_type == "object":
def_args += " GType type;\n"
def_args += " PyObject *type_obj;\n"
def_args += " GObject *res;"
kwargs_str = '"type", "data", NULL'
fmt = "Os"
args_addr = "&type_obj, &data"
args = "type, data"
else:
def_args += " " + type_table[ret_type][0] + " res;"
kwargs_str = '"data", NULL'
fmt = "s"
args_addr = "&data"
args = "data"
ret_func = ret_table[ret_type] + "(res);"
return string.Template(fret_template)\
.substitute(Suffix=Suffix, suffix=suffix,
def_args=def_args, kwargs_str=kwargs_str,
fmt=fmt, args_addr=args_addr, args=args,
ret_func=ret_func)
def gen_fret_list():
from rpc_table import func_table
ret_type_list = []
for item in func_table:
if item[0] not in ret_type_list:
ret_type_list.append(item[0])
for item in ret_type_list:
print gen_fret_func(item)
# XXX: generate searpc.py file
searpc_file_hdr_template = r"""
import os
import sys
sys.path += ['', '.libs']
import json
import new
import types
from searpc_client import SearpcClientBase
"""
searpc_client_template = r"""
class SearpcClient(SearpcClientBase):
pass
def searpc_client_transport_send(client, fcall):
return client.transport_send(fcall, client.priv)
"""
searpc_defun_template = r"""
def defun_${ret_type}__${args_type}(func):
def newfunc(${args1}):
fcall = self.fcall__${args_type}(${args2})
fret = searpc_client_transport_send(self, fcall)
if fret is None:
return None
return self.fret__${ret_type}(${obj_type}fret)
return newfunc
"""
def gen_decorator(ret_type, args_type_list):
if len(args_type_list) == 0:
args_type = "void"
args1 = "self"
args2 = "func.__name__"
return string.Template(searpc_defun_template)\
.substitute(ret_type=ret_type, args_type=args_type,
args1=args1, args2=args2, obj_type="")
args_type = "_".join(args_type_list)
args1 = "self"
args2 = "func.__name__"
obj_type = ""
if ret_type == "object" or ret_type == "objlist":
args1 += ", obj_type"
obj_type = "obj_type, "
for i, arg_type in enumerate(args_type_list):
args1 += ", param" + str(i + 1)
args2 += ", param" + str(i + 1)
return string.Template(searpc_defun_template)\
.substitute(ret_type=ret_type, args_type=args_type,
args1=args1, args2=args2, obj_type=obj_type)
def gen_func_decorator():
from rpc_table import func_table
for item in func_table:
print gen_decorator(item[0], item[1])
def gen_pysearpc():
print searpc_file_hdr_template
print searpc_client_template
gen_func_decorator()
if __name__ == "__main__":
cmd = sys.argv[1]
if cmd == "gen-searpcclient":
gen_fcall_list()
gen_module_funcs_array()
elif cmd == "gen-pysearpc":
gen_pysearpc()
else:
print "arg error"

View File

@@ -0,0 +1,57 @@
import sys
import socket
from struct import pack, unpack
from pysearpc import SearpcClient, searpc_func
SERVER_ADDR = '127.0.0.1'
SERVER_PORT = 12345
def recv_all(sock, length):
"""
read all n bytes of data from sock
"""
data = ''
while len(data) < length:
more = sock.recv(length - len(data))
if not more:
raise EOFError('socket closed %d bytes into a %d-byte message' % (len(data), length))
data += more
return data
class SampleRpcClient(SearpcClient):
def call_remote_func_sync(self, fcall_str):
"""
called by searpc_func to send the request and receive the result
"""
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
# connect to server
s.connect((SERVER_ADDR, SERVER_PORT))
# send the header
header = pack('!h', len(fcall_str));
s.sendall(header)
# send the JSON data
s.sendall(fcall_str)
# read the returned header
header_r = recv_all(s, 2)
#read the result
ret_len = list(unpack('!h', header_r))[0]
if ret_len <= 0:
raise AssertionError, "returned data length <= 0"
ret_str = recv_all(s, ret_len)
return ret_str
@searpc_func("int", ["string"])
def searpc_demo_int__string(self):
pass
client = SampleRpcClient()
res = client.searpc_demo_int__string("hello world")
print 'result from server:', res

View File

@@ -0,0 +1,37 @@
import os
import sys
sys.path += ['', '.libs']
RPC_PROC_ID = 1003
SC_CLIENT_CALL = "301"
SS_CLIENT_CALL = "CLIENT CALL"
SC_SERVER_RET = "311"
SS_SERVER_RET = "SERVER RET"
def searpc_transport_send(fcall, priv):
if priv.peerid is None:
proc_name = "%s-rpcserver" % (priv.service)
else:
proc_name = "remote %s %s-rpcserver" % (priv.peerid, priv.service)
priv.session.send_request(RPC_PROC_ID, proc_name)
if priv.session.read_response() < 0:
return None
rsp = priv.session.response
if rsp[0] != "200":
print "[Sea RPC] failed to start rpc server.\n"
return None
priv.session.send_update(RPC_PROC_ID, "301", "CLIENT CALL",
fcall, len(fcall))
if priv.session.read_response() < 0:
return None
rsp = priv.session.response
if rsp[0] == SC_SERVER_RET:
return rsp[2]
else:
print "[Sea RPC] Bad response: %s %s.\n" % (rsp[0], rsp[1])
return None

20
rpc_table.py Normal file
View File

@@ -0,0 +1,20 @@
"""
Define RPC functions needed to generate
"""
# [ <ret-type>, [<arg_types>] ]
func_table = [
[ "int", ["string"] ],
[ "int", ["string", "string"] ],
[ "string", [] ],
[ "string", ["string"] ],
[ "string", ["string", "int"] ],
[ "objlist", [] ],
[ "objlist", ["string"] ],
[ "objlist", ["int", "int"] ],
[ "objlist", ["string", "int"] ],
[ "objlist", ["string", "int", "int"] ],
[ "objlist", ["string", "string", "int"] ],
[ "object", [] ],
[ "object", ["string"] ],
]

217
searpc-client.c Normal file
View File

@@ -0,0 +1,217 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <json-glib/json-glib.h>
#include "searpc-client.h"
#include "searpc-utils.h"
SearpcClient *
searpc_client_new ()
{
return g_new0 (SearpcClient, 1);
}
void
searpc_client_free (SearpcClient *client)
{
if (!client)
return;
g_free (client);
}
char *
searpc_client_transport_send (SearpcClient *client,
const gchar *fcall_str,
size_t fcall_len,
size_t *ret_len)
{
return client->transport(client->arg, fcall_str,
fcall_len, ret_len);
}
/*
* serialize function call from array to string
*/
static char *
fcall_common (JsonArray *array, gsize *len)
{
gchar *data;
JsonGenerator *gen = json_generator_new ();
JsonNode *root;
root = json_node_new (JSON_NODE_ARRAY);
json_node_take_array (root, array);
json_generator_set_root (gen, root);
g_object_set (gen, "pretty", FALSE, NULL);
data = json_generator_to_data (gen, len);
json_node_free (root);
g_object_unref (gen);
return data;
}
#include "fcall-impr.h"
/*
* Returns -1 if error happens in parsing data or data contains error
* message. In this case, the calling function should simply return
* to up layer.
*
* Returns 0 otherwise, and root is set to the root node, object set
* to the root node's containing object.
*/
static int
handle_ret_common (char *data, size_t len, JsonParser **parser,
JsonNode **root,
JsonObject **object, GError **error)
{
gint err_code;
const gchar *err_msg;
g_return_val_if_fail (root != 0 || object != 0, -1);
*parser = json_parser_new ();
if (!json_parser_load_from_data (*parser, data, strlen(data), error)) {
g_object_unref (*parser);
*parser = NULL;
return -1;
}
*root = json_parser_get_root (*parser);
*object = json_node_get_object (*root);
if (*object == NULL) {
g_set_error (error, 0, 502, "Invalid data: not a object");
g_object_unref (*parser);
*parser = NULL;
*root = NULL;
return -1;
}
if (json_object_has_member (*object, "err_code")) {
err_code = json_object_get_int_member (*object, "err_code");
err_msg = json_object_get_string_or_null_member (*object, "err_msg");
g_set_error (error, 0, err_code, "%s", err_msg);
g_object_unref (*parser);
*parser = NULL;
*object = NULL;
*root = NULL;
return -1;
}
return 0;
}
char *
searpc_client_fret__string (char *data, size_t len, GError **error)
{
JsonParser *parser = NULL;
JsonObject *object = NULL;
JsonNode *root = NULL;
gchar *ret_str = NULL;
if (handle_ret_common(data, len, &parser, &root, &object, error) == 0) {
ret_str = g_strdup (
json_object_get_string_or_null_member (object, "ret"));
g_object_unref (parser);
return ret_str;
}
return NULL;
}
int
searpc_client_fret__int (char *data, size_t len, GError **error)
{
JsonParser *parser = NULL;
JsonNode *root = NULL;
JsonObject *object = NULL;
int ret;
if (handle_ret_common(data, len, &parser, &root, &object, error) == 0) {
ret = (int) json_object_get_int_member(object, "ret");
g_object_unref (parser);
return ret;
}
return -1;
}
GObject*
searpc_client_fret__object (GType gtype, char *data, size_t len, GError **error)
{
JsonParser *parser = NULL;
JsonNode *root = NULL;
JsonObject *object = NULL;
GObject *ret = NULL;
JsonNode *member;
if (handle_ret_common(data, len, &parser, &root, &object, error) == 0) {
member = json_object_get_member (object, "ret");
if (json_node_get_node_type(member) == JSON_NODE_NULL) {
g_object_unref (parser);
return NULL;
}
ret = json_gobject_deserialize(gtype, member);
g_object_unref (parser);
return ret;
}
return NULL;
}
static void clean_objlist(GList *list)
{
GList *ptr;
for (ptr = list; ptr; ptr = ptr->next)
g_object_unref(ptr->data);
g_list_free (list);
}
GList*
searpc_client_fret__objlist (GType gtype, char *data, size_t len, GError **error)
{
JsonParser *parser = NULL;
JsonNode *root = NULL;
JsonObject *object = NULL;
JsonArray *array;
JsonNode *member;
GList *ret = NULL;
if (handle_ret_common(data, len, &parser, &root, &object, error) == 0) {
member = json_object_get_member (object, "ret");
if (json_node_get_node_type(member) == JSON_NODE_NULL) {
g_object_unref (parser);
return NULL;
}
array = json_node_get_array (member);
g_assert (array);
int i;
for (i = 0; i < json_array_get_length(array); i++) {
JsonNode *member = json_array_get_element (array, i);
GObject *obj = json_gobject_deserialize(gtype, member);
if (obj == NULL) {
g_set_error (error, 0, 503,
"Invalid data: object list contains null");
clean_objlist(ret);
g_object_unref (parser);
return NULL;
}
ret = g_list_prepend (ret, obj);
}
g_object_unref (parser);
return g_list_reverse(ret);
}
return NULL;
}

49
searpc-client.h Normal file
View File

@@ -0,0 +1,49 @@
#ifndef SEARPC_CLIENT_H
#define SEARPC_CLIENT_H
#include <glib.h>
#include <glib-object.h>
typedef char *(*TransportCB)(void *arg, const gchar *fcall_str,
size_t fcall_len, size_t *ret_len);
typedef struct {
TransportCB transport;
void *arg;
} SearpcClient;
SearpcClient *searpc_client_new ();
void searpc_client_free (SearpcClient *client);
char* searpc_client_transport_send (SearpcClient *client,
const gchar *fcall_str,
size_t fcall_len,
size_t *ret_len);
#include <searpc-fcall.h>
/**
* searpc_client_fret__string:
* @data: the return string of RPC call
* @len: then length of @data
* @error: return location for a #GError, or %NULL
*
* Extract return value of type `char*` from the return string of RPC
* call.
*/
char* searpc_client_fret__string (char *data, size_t len, GError **error);
int searpc_client_fret__int (char *data, size_t len, GError **error);
GObject* searpc_client_fret__object (GType gtype, char *data,
size_t len, GError **error);
GList* searpc_client_fret__objlist (GType gtype, char *data,
size_t len, GError **error);
#define TRANSPORT_ERROR "Transport Error"
#define TRANSPORT_ERROR_CODE 500
#include <searpc-dfun.h>
#endif

104
searpc-demo-client.c Normal file
View File

@@ -0,0 +1,104 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <glib-object.h>
#include "searpc-client.h"
#include "searpc-demo-packet.h"
#define BUFLEN 256
#define MAGIC_STRING "ABCD"
/* define the client-side function */
SEARPC_CLIENT_DEFUN_INT__STRING(searpc_demo_int__string);
static char *transport_callback(void *arg, const char *fcall_str,
size_t fcall_len, size_t *ret_len)
{
int fd, ret;
char buf[BUFLEN];
packet *pac, *pac_ret;
fd = (int) arg;
pac = (packet *)buf;
/* construct the packet */
pac->length = htons((uint16_t)fcall_len);
strncpy(pac->data, fcall_str, fcall_len);
/* send the packet */
if ( writen (fd, buf, PACKET_HEADER_LENGTH + fcall_len) == -1) {
fprintf (stderr, "write failed: %s\n", strerror(errno));
exit(-1);
}
/* read the returned packet */
pac_ret = read_packet(fd, buf);
if (pac_ret == NULL) {
fprintf(stderr, "read packet failed: %s\n", strerror(errno));
exit(-1);
}
*ret_len = ntohs(pac_ret->length);
return strndup(pac_ret->data, *ret_len);
}
main(int argc, char *argv[])
{
int sockfd, ret;
char *ret_str;
struct sockaddr_in servaddr;
SearpcClient *rpc_client;
GError *error = NULL;
g_type_init();
ret = sockfd = socket(AF_INET, SOCK_STREAM, 0);
if (ret < 0) {
fprintf(stderr, "socket failed: %s\n", strerror(errno));
exit(-1);
}
int on = 1;
if (setsockopt (sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) {
fprintf (stderr, "setsockopt of SO_REUSEADDR error: %s\n", strerror(errno));
exit(-1);
}
memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = htons(12345);
inet_pton(AF_INET, "127.0.0.1", &servaddr.sin_addr);
ret = connect(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr));
if (ret < 0) {
fprintf(stderr, "connect failed: %s\n", strerror(errno));
exit(-1);
}
/* create an rpc_client and supply the transport function. */
rpc_client = searpc_client_new();
rpc_client->transport = transport_callback;
rpc_client->arg = (void *)sockfd;
/* call the client-side funcion */
ret = searpc_demo_int__string(rpc_client, "hello searpc", &error);
if (error != NULL) {
fprintf(stderr, "error: %s\n", error->message);
exit(-1);
} else
printf("%d\n", ret);
close(sockfd);
return 0;
}

87
searpc-demo-packet.h Normal file
View File

@@ -0,0 +1,87 @@
#ifndef _PACKET_H
#define _PACKET_H
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
typedef struct packet {
uint16_t length;
char data[0];
} packet;
# define PACKET_HEADER_LENGTH sizeof(packet)
static ssize_t /* Write "n" bytes to a descriptor. */
writen(int fd, const void *vptr, size_t n)
{
size_t nleft;
ssize_t nwritten;
const char *ptr;
ptr = vptr;
nleft = n;
while (nleft > 0) {
if ( (nwritten = write(fd, ptr, nleft)) <= 0) {
if (nwritten < 0 && errno == EINTR)
nwritten = 0; /* and call write() again */
else
return(-1); /* error */
}
nleft -= nwritten;
ptr += nwritten;
}
return(n);
}
static ssize_t /* Read "n" bytes from a descriptor. */
readn(int fd, char *buf, size_t n)
{
size_t nleft;
ssize_t nread;
nleft = n;
while (nleft > 0) {
if ( (nread = read(fd, buf, nleft)) < 0) {
if (errno == EINTR)
nread = 0; /* and call read() again */
else
return(-1);
} else if (nread == 0)
break; /* EOF */
nleft -= nread;
buf += nread;
}
return(n - nleft); /* return >= 0 */
}
/* read a packet into a buffer, and return the pacet pointer */
packet *
read_packet(int sockfd, char *buf)
{
packet *pac;
int len;
/* read the length part */
if (readn (sockfd, buf, PACKET_HEADER_LENGTH) != PACKET_HEADER_LENGTH) {
fprintf(stderr, "read header error: %s\n", strerror(errno));
exit(-1);
}
pac = (packet *)buf;
len = ntohs(pac->length);
/* read the data */
if (len <= 0)
return NULL;
else if (readn (sockfd, buf + PACKET_HEADER_LENGTH, len) != len)
return NULL;
return pac;
}
#endif

112
searpc-demo-server.c Normal file
View File

@@ -0,0 +1,112 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "searpc-server.h"
#include "searpc-demo-packet.h"
#define BUFLEN 256
static int
searpc_demo_int__string(const char *str)
{
if (str == NULL)
return -1;
else
return strlen(str);
}
static void
start_rpc_service(void)
{
searpc_server_init();
searpc_server_register_function(searpc_demo_int__string,
"searpc_demo_int__string",
searpc_signature_int__string());
}
int
main(int argc, char *argv[])
{
int listenfd, connfd;
int ret;
struct sockaddr_in client_addr, server_addr;
socklen_t clilen;
char buf[BUFLEN];
packet *pac, *pac_ret;
g_type_init();
start_rpc_service();
listenfd = socket(AF_INET, SOCK_STREAM, 0);
if (listenfd < 0) {
fprintf(stderr, "socket failed: %s\n", strerror(errno));
exit(-1);
}
int on = 1;
if (setsockopt (listenfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0) {
fprintf (stderr, "setsockopt of SO_REUSEADDR error: %s\n", strerror(errno));
exit(-1);
}
memset(&server_addr, 0, sizeof(server_addr));
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
server_addr.sin_port = htons(12345);
ret = bind(listenfd, (struct sockaddr *)&server_addr,
sizeof(server_addr));
if (ret < 0) {
fprintf(stderr, "bind failed: %s\n", strerror(errno));
exit(-1);
}
ret = listen(listenfd, 5);
if (ret < 0) {
fprintf(stderr, "listen failed: %s\n", strerror(errno));
exit(-1);
}
while (1) {
clilen = sizeof(client_addr);
connfd = accept(listenfd, (struct sockaddr *)&client_addr, &clilen);
if (connfd < 0) {
fprintf(stderr, "accept failed: %s\n", strerror(errno));
continue;
}
/* read the header packet */
pac = read_packet(connfd, buf);
if (pac == NULL) {
fprintf(stderr, "read packet failed: %s\n", strerror(errno));
exit(-1);
}
gsize ret_len;
int fcall_len = ntohs(pac->length);
/* Execute the RPC function */
char *res = searpc_server_call_function (pac->data, fcall_len, &ret_len);
pac_ret = (packet *)buf;
pac_ret->length = htons((uint16_t)ret_len);
strncpy(pac_ret->data, res, ret_len);
/* send the ret packet */
if (writen (connfd, buf, PACKET_HEADER_LENGTH + ret_len) == -1) {
fprintf (stderr, "write packet failed: %s\n", strerror(errno));
exit(-1);
}
}
return 0;
}

351
searpc-dfun.h Normal file
View File

@@ -0,0 +1,351 @@
#define SEARPC_CLIENT_DEFUN_INT__STRING(funcname) \
int \
funcname (SearpcClient *client, const gchar* param1, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
int result; \
\
fcall = searpc_client_fcall__string (#funcname, \
param1, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return -1; \
} \
result = searpc_client_fret__int (fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_INT__STRING_STRING(funcname) \
int \
funcname (SearpcClient *client, const gchar* param1, const gchar* param2, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
int result; \
\
fcall = searpc_client_fcall__string_string (#funcname, \
param1, param2, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return -1; \
} \
result = searpc_client_fret__int (fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_STRING__VOID(funcname) \
gchar* \
funcname (SearpcClient *client, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
gchar* result; \
\
fcall = searpc_client_fcall__void (#funcname, \
&fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__string (fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_STRING__STRING(funcname) \
gchar* \
funcname (SearpcClient *client, const gchar* param1, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
gchar* result; \
\
fcall = searpc_client_fcall__string (#funcname, \
param1, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__string (fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_STRING__STRING_INT(funcname) \
gchar* \
funcname (SearpcClient *client, const gchar* param1, int param2, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
gchar* result; \
\
fcall = searpc_client_fcall__string_int (#funcname, \
param1, param2, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__string (fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_OBJLIST__VOID(funcname, gtype) \
GList* \
funcname (SearpcClient *client, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
GList* result; \
\
fcall = searpc_client_fcall__void (#funcname, \
&fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__objlist (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_OBJLIST__STRING(funcname, gtype) \
GList* \
funcname (SearpcClient *client, const gchar* param1, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
GList* result; \
\
fcall = searpc_client_fcall__string (#funcname, \
param1, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__objlist (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_OBJLIST__INT_INT(funcname, gtype) \
GList* \
funcname (SearpcClient *client, int param1, int param2, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
GList* result; \
\
fcall = searpc_client_fcall__int_int (#funcname, \
param1, param2, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__objlist (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_OBJLIST__STRING_INT(funcname, gtype) \
GList* \
funcname (SearpcClient *client, const gchar* param1, int param2, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
GList* result; \
\
fcall = searpc_client_fcall__string_int (#funcname, \
param1, param2, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__objlist (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_OBJLIST__STRING_INT_INT(funcname, gtype) \
GList* \
funcname (SearpcClient *client, const gchar* param1, int param2, int param3, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
GList* result; \
\
fcall = searpc_client_fcall__string_int_int (#funcname, \
param1, param2, param3, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__objlist (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_OBJLIST__STRING_STRING_INT(funcname, gtype) \
GList* \
funcname (SearpcClient *client, const gchar* param1, const gchar* param2, int param3, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
GList* result; \
\
fcall = searpc_client_fcall__string_string_int (#funcname, \
param1, param2, param3, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__objlist (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_OBJECT__VOID(funcname, gtype) \
GObject* \
funcname (SearpcClient *client, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
GObject* result; \
\
fcall = searpc_client_fcall__void (#funcname, \
&fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__object (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}
#define SEARPC_CLIENT_DEFUN_OBJECT__STRING(funcname, gtype) \
GObject* \
funcname (SearpcClient *client, const gchar* param1, GError **error) \
{ \
char *fcall, *fret; \
size_t fcall_len, ret_len; \
GObject* result; \
\
fcall = searpc_client_fcall__string (#funcname, \
param1, &fcall_len); \
fret = searpc_client_transport_send (client, \
fcall, \
fcall_len, \
&ret_len); \
if (!fret) { \
g_free (fcall); \
g_set_error (error, 0, TRANSPORT_ERROR_CODE, TRANSPORT_ERROR); \
return NULL; \
} \
result = searpc_client_fret__object (gtype, fret, ret_len, error); \
\
g_free (fcall); \
g_free (fret); \
return result; \
}

21
searpc-fcall.h Normal file
View File

@@ -0,0 +1,21 @@
char* searpc_client_fcall__string (const char* fname, const gchar* param1, gsize *len);
char* searpc_client_fcall__string_string (const char* fname, const gchar* param1, const gchar* param2, gsize *len);
char* searpc_client_fcall__void (const char* fname, gsize *len);
char* searpc_client_fcall__string_int (const char* fname, const gchar* param1, int param2, gsize *len);
char* searpc_client_fcall__int_int (const char* fname, int param1, int param2, gsize *len);
char* searpc_client_fcall__string_int_int (const char* fname, const gchar* param1, int param2, int param3, gsize *len);
char* searpc_client_fcall__string_string_int (const char* fname, const gchar* param1, const gchar* param2, int param3, gsize *len);

281
searpc-marshal.h Normal file
View File

@@ -0,0 +1,281 @@
static gchar *
marshal_int__string (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
int ret = ((int (*)(const gchar*, GError **))func) (param1, &error);
JsonObject *object = json_object_new ();
set_int_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_int__string_string (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
const gchar* param2 = json_array_get_string_or_null_element (param_array, 2);
int ret = ((int (*)(const gchar*, const gchar*, GError **))func) (param1, param2, &error);
JsonObject *object = json_object_new ();
set_int_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_string__void (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
gchar* ret = ((gchar* (*)(GError **))func) (&error);
JsonObject *object = json_object_new ();
set_string_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_string__string (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
gchar* ret = ((gchar* (*)(const gchar*, GError **))func) (param1, &error);
JsonObject *object = json_object_new ();
set_string_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_string__string_int (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
int param2 = json_array_get_int_element (param_array, 2);
gchar* ret = ((gchar* (*)(const gchar*, int, GError **))func) (param1, param2, &error);
JsonObject *object = json_object_new ();
set_string_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_objlist__void (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
GList* ret = ((GList* (*)(GError **))func) (&error);
JsonObject *object = json_object_new ();
set_objlist_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_objlist__string (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
GList* ret = ((GList* (*)(const gchar*, GError **))func) (param1, &error);
JsonObject *object = json_object_new ();
set_objlist_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_objlist__int_int (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
int param1 = json_array_get_int_element (param_array, 1);
int param2 = json_array_get_int_element (param_array, 2);
GList* ret = ((GList* (*)(int, int, GError **))func) (param1, param2, &error);
JsonObject *object = json_object_new ();
set_objlist_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_objlist__string_int (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
int param2 = json_array_get_int_element (param_array, 2);
GList* ret = ((GList* (*)(const gchar*, int, GError **))func) (param1, param2, &error);
JsonObject *object = json_object_new ();
set_objlist_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_objlist__string_int_int (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
int param2 = json_array_get_int_element (param_array, 2);
int param3 = json_array_get_int_element (param_array, 3);
GList* ret = ((GList* (*)(const gchar*, int, int, GError **))func) (param1, param2, param3, &error);
JsonObject *object = json_object_new ();
set_objlist_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_objlist__string_string_int (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
const gchar* param2 = json_array_get_string_or_null_element (param_array, 2);
int param3 = json_array_get_int_element (param_array, 3);
GList* ret = ((GList* (*)(const gchar*, const gchar*, int, GError **))func) (param1, param2, param3, &error);
JsonObject *object = json_object_new ();
set_objlist_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_object__void (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
GObject* ret = ((GObject* (*)(GError **))func) (&error);
JsonObject *object = json_object_new ();
set_object_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static gchar *
marshal_object__string (void *func, JsonArray *param_array, gsize *ret_len)
{
GError *error = NULL;
const gchar* param1 = json_array_get_string_or_null_element (param_array, 1);
GObject* ret = ((GObject* (*)(const gchar*, GError **))func) (param1, &error);
JsonObject *object = json_object_new ();
set_object_to_ret_object (object, ret);
return marshal_set_ret_common (object, ret_len, error);
}
static void register_marshals(GHashTable *marshal_table)
{
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_int__string;
item->signature = searpc_signature_int__string();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_int__string_string;
item->signature = searpc_signature_int__string_string();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_string__void;
item->signature = searpc_signature_string__void();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_string__string;
item->signature = searpc_signature_string__string();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_string__string_int;
item->signature = searpc_signature_string__string_int();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_objlist__void;
item->signature = searpc_signature_objlist__void();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_objlist__string;
item->signature = searpc_signature_objlist__string();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_objlist__int_int;
item->signature = searpc_signature_objlist__int_int();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_objlist__string_int;
item->signature = searpc_signature_objlist__string_int();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_objlist__string_int_int;
item->signature = searpc_signature_objlist__string_int_int();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_objlist__string_string_int;
item->signature = searpc_signature_objlist__string_string_int();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_object__void;
item->signature = searpc_signature_object__void();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
{
MarshalItem *item = g_new0(MarshalItem, 1);
item->mfunc = marshal_object__string;
item->signature = searpc_signature_object__string();
g_hash_table_insert (marshal_table, (gpointer)item->signature, item);
}
}

215
searpc-server.c Normal file
View File

@@ -0,0 +1,215 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <json-glib/json-glib.h>
#include "searpc-server.h"
#include "searpc-utils.h"
struct FuncItem;
typedef struct MarshalItem {
SearpcMarshalFunc mfunc;
const gchar *signature;
} MarshalItem;
typedef struct FuncItem {
void *func;
const gchar *fname;
MarshalItem *marshal;
} FuncItem;
static GHashTable *marshal_table;
static GHashTable *func_table;
/* Marshal functions */
static inline void
set_string_to_ret_object (JsonObject *object, gchar *ret)
{
if (ret == NULL)
json_object_set_null_member (object, "ret");
else {
json_object_set_string_member (object, "ret", ret);
g_free (ret);
}
}
static inline void
set_int_to_ret_object (JsonObject *object, gint64 ret)
{
json_object_set_int_member (object, "ret", ret);
}
static inline void
set_object_to_ret_object (JsonObject *object, GObject *ret)
{
if (ret == NULL)
json_object_set_null_member (object, "ret");
else {
json_object_set_member (object, "ret", json_gobject_serialize(ret));
g_object_unref (ret);
}
}
static inline void
set_objlist_to_ret_object (JsonObject *object, GList *ret)
{
GList *ptr;
if (ret == NULL)
json_object_set_null_member (object, "ret");
else {
JsonArray *array = json_array_new ();
for (ptr = ret; ptr; ptr = ptr->next)
json_array_add_element (array, json_gobject_serialize (ptr->data));
json_object_set_array_member (object, "ret", array);
for (ptr = ret; ptr; ptr = ptr->next)
g_object_unref (ptr->data);
g_list_free (ret);
}
}
static gchar *
marshal_set_ret_common (JsonObject *object, gsize *len, GError *error)
{
JsonNode *root = json_node_new (JSON_NODE_OBJECT);
JsonGenerator *generator = json_generator_new ();
gchar *data;
if (error) {
json_object_set_int_member (object, "err_code", error->code);
json_object_set_string_or_null_member (object, "err_msg", error->message);
g_error_free (error);
}
json_node_take_object (root, object);
json_generator_set_root (generator, root);
g_object_set (generator, "pretty", FALSE, NULL);
data = json_generator_to_data (generator, len);
json_node_free (root);
g_object_unref (generator);
return data;
}
/* include the generated marshal functions */
#include <searpc-marshal.h>
void
searpc_server_init ()
{
func_table = g_hash_table_new_full (g_str_hash, g_str_equal,
NULL, g_free);
marshal_table = g_hash_table_new (g_str_hash, g_str_equal);
/* register buildin marshal functions */
register_marshals(marshal_table);
}
gboolean
searpc_server_register_marshal (const gchar *signature, SearpcMarshalFunc marshal)
{
MarshalItem *mitem;
g_assert (signature != NULL && marshal != NULL);
if (g_hash_table_lookup (marshal_table, signature) != NULL) {
g_warning ("[Sea RPC] cannot register duplicate marshal.\n");
return FALSE;
}
mitem = g_new0 (MarshalItem, 1);
mitem->mfunc = marshal;
mitem->signature = signature;
g_hash_table_insert (marshal_table, (gpointer)mitem->signature, mitem);
return TRUE;
}
gboolean
searpc_server_register_function (void *func, const gchar *fname, const gchar *signature)
{
FuncItem *item;
MarshalItem *mitem;
g_assert (func != NULL && fname != NULL && signature != NULL);
mitem = g_hash_table_lookup (marshal_table, signature);
if (!mitem)
return FALSE;
item = g_new0 (FuncItem, 1);
item->marshal = mitem;
item->fname = g_strdup(fname);
item->func = func;
g_hash_table_insert (func_table, (gpointer)item->fname, item);
return TRUE;
}
/* Called by RPC transport. */
gchar*
searpc_server_call_function (gchar *func, gsize len, gsize *ret_len)
{
JsonParser *parser;
GError *error = NULL;
JsonNode *root;
JsonArray *array;
parser = json_parser_new ();
if (!json_parser_load_from_data (parser, func, len, &error)) {
g_warning ("[SeaRPC] failed to parse RPC call: %s\n", error->message);
g_error_free (error);
return NULL;
}
root = json_parser_get_root (parser);
array = json_node_get_array (root);
const char *fname = json_array_get_string_element(array, 0);
FuncItem *fitem = g_hash_table_lookup(func_table, fname);
if (!fitem) {
g_warning ("[SeaRPC] cannot find function %s.\n", fname);
return NULL;
}
gchar* ret = fitem->marshal->mfunc (fitem->func, array, ret_len);
g_object_unref (parser);
return ret;
}
char*
searpc_compute_signature(gchar *ret_type, int pnum, ...)
{
va_list ap;
int i = 0;
char *ret;
GChecksum *cksum = g_checksum_new (G_CHECKSUM_MD5);
g_checksum_update (cksum, (const guchar*)ret_type, -1);
va_start(ap, pnum);
for (; i<pnum; i++) {
char *ptype = va_arg (ap, char *);
g_checksum_update (cksum, (const guchar*)":", -1);
g_checksum_update (cksum, (const guchar*)ptype, -1);
}
va_end(ap);
ret = g_strdup (g_checksum_get_string (cksum));
g_checksum_free (cksum);
return ret;
}

59
searpc-server.h Normal file
View File

@@ -0,0 +1,59 @@
#ifndef SEARPC_SERVER_H
#define SEARPC_SERVER_H
#include <glib.h>
struct _JsonArray;
typedef gchar* (*SearpcMarshalFunc) (void *func, struct _JsonArray *param_array,
gsize *ret_len);
/**
* searpc_server_init:
*
* Inititalize searpc server.
*/
void searpc_server_init ();
/**
* searpc_server_register_marshal:
*
* For user to extend marshal functions.
*/
gboolean searpc_server_register_marshal (const gchar *signature,
SearpcMarshalFunc marshal);
/**
* searpc_server_register_function:
*
* Register a rpc function with given signature.
*/
gboolean searpc_server_register_function (void* func,
const gchar *fname,
const gchar *signature);
/**
* searpc_server_call_function:
* @func: the serialized representation of the function to call.
* @len: length of @func.
* @ret_len: the length of the returned string.
*
* Call a registered function @func.
*
* Returns the serialized representatio of the returned value.
*/
gchar *searpc_server_call_function (gchar *func, gsize len, gsize *ret_len);
/**
* searpc_compute_signature:
* @ret_type: the return type of the function.
* @pnum: number of parameters of the function.
*
* Compute function signature.
*/
char* searpc_compute_signature (gchar *ret_type, int pnum, ...);
/* Signatures */
#include <searpc-signature.h>
#endif

91
searpc-signature.h Normal file
View File

@@ -0,0 +1,91 @@
inline static const gchar *
searpc_signature_int__string()
{
return searpc_compute_signature ("int", 1, "string");
}
inline static const gchar *
searpc_signature_int__string_string()
{
return searpc_compute_signature ("int", 2, "string", "string");
}
inline static const gchar *
searpc_signature_string__void()
{
return searpc_compute_signature ("string", 0);
}
inline static const gchar *
searpc_signature_string__string()
{
return searpc_compute_signature ("string", 1, "string");
}
inline static const gchar *
searpc_signature_string__string_int()
{
return searpc_compute_signature ("string", 2, "string", "int");
}
inline static const gchar *
searpc_signature_objlist__void()
{
return searpc_compute_signature ("objlist", 0);
}
inline static const gchar *
searpc_signature_objlist__string()
{
return searpc_compute_signature ("objlist", 1, "string");
}
inline static const gchar *
searpc_signature_objlist__int_int()
{
return searpc_compute_signature ("objlist", 2, "int", "int");
}
inline static const gchar *
searpc_signature_objlist__string_int()
{
return searpc_compute_signature ("objlist", 2, "string", "int");
}
inline static const gchar *
searpc_signature_objlist__string_int_int()
{
return searpc_compute_signature ("objlist", 3, "string", "int", "int");
}
inline static const gchar *
searpc_signature_objlist__string_string_int()
{
return searpc_compute_signature ("objlist", 3, "string", "string", "int");
}
inline static const gchar *
searpc_signature_object__void()
{
return searpc_compute_signature ("object", 0);
}
inline static const gchar *
searpc_signature_object__string()
{
return searpc_compute_signature ("object", 1, "string");
}

46
searpc-utils.h Normal file
View File

@@ -0,0 +1,46 @@
#ifndef SEARPC_UTILS_H
#define SEARPC_UTILS_H
#include <json-glib/json-glib.h>
inline static const gchar *
json_object_get_string_or_null_member (JsonObject *object, const gchar *member_name)
{
if (!json_object_get_null_member (object, member_name))
return json_object_get_string_member (object, member_name);
else
return NULL;
}
inline static void
json_object_set_string_or_null_member (JsonObject *object,
const gchar *member_name,
const gchar *value)
{
if (value)
json_object_set_string_member (object, member_name, value);
else
json_object_set_null_member (object, member_name);
}
inline static const gchar *
json_array_get_string_or_null_element (JsonArray *array, guint index)
{
if (!json_array_get_null_element (array, index))
return json_array_get_string_element (array, index);
else
return NULL;
}
inline static void
json_array_add_string_or_null_element (JsonArray *array, const gchar *value)
{
if (value)
json_array_add_string_element (array, value);
else
json_array_add_null_element (array);
}
#endif

13
tests/Makefile.am Normal file
View File

@@ -0,0 +1,13 @@
AM_CFLAGS = -I$(top_srcdir)/include @GLIB2_CFLAGS@ @GOBJECT_CFLAGS@ \
-I$(top_srcdir)/lib -I$(top_srcdir)/lib/searpc \
@JSON_GLIB_CFLAGS@
check_PROGRAMS = test-searpc
test_searpc_SOURCES = test-searpc.c
test_searpc_LDADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ \
$(top_builddir)/libsearpc.la
test_searpc_LDFLAGS = -static
TESTS = test-searpc

591
tests/Makefile.in Normal file
View File

@@ -0,0 +1,591 @@
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@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@
check_PROGRAMS = test-searpc$(EXEEXT)
TESTS = test-searpc$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am_test_searpc_OBJECTS = test-searpc.$(OBJEXT)
test_searpc_OBJECTS = $(am_test_searpc_OBJECTS)
test_searpc_DEPENDENCIES = $(top_builddir)/libsearpc.la
test_searpc_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(test_searpc_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
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 = $(test_searpc_SOURCES)
DIST_SOURCES = $(test_searpc_SOURCES)
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
GLIB2_CFLAGS = @GLIB2_CFLAGS@
GLIB2_LIBS = @GLIB2_LIBS@
GOBJECT_CFLAGS = @GOBJECT_CFLAGS@
GOBJECT_LIBS = @GOBJECT_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JSON_GLIB_CFLAGS = @JSON_GLIB_CFLAGS@
JSON_GLIB_LIBS = @JSON_GLIB_LIBS@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
PYGOBJECT_CFLAGS = @PYGOBJECT_CFLAGS@
PYGOBJECT_LIBS = @PYGOBJECT_LIBS@
PYTHON = @PYTHON@
PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
PYTHON_PLATFORM = @PYTHON_PLATFORM@
PYTHON_PREFIX = @PYTHON_PREFIX@
PYTHON_VERSION = @PYTHON_VERSION@
RANLIB = @RANLIB@
SED = @SED@
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_DUMPBIN = @ac_ct_DUMPBIN@
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@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
pkgpyexecdir = @pkgpyexecdir@
pkgpythondir = @pkgpythondir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
pyexecdir = @pyexecdir@
pythondir = @pythondir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CFLAGS = -I$(top_srcdir)/include @GLIB2_CFLAGS@ @GOBJECT_CFLAGS@ \
-I$(top_srcdir)/lib -I$(top_srcdir)/lib/searpc \
@JSON_GLIB_CFLAGS@
test_searpc_SOURCES = test-searpc.c
test_searpc_LDADD = @GLIB2_LIBS@ @GOBJECT_LIBS@ \
$(top_builddir)/libsearpc.la
test_searpc_LDFLAGS = -static
all: all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tests/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign tests/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: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
echo " rm -f" $$list; \
rm -f $$list || exit $$?; \
test -n "$(EXEEXT)" || exit 0; \
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
test-searpc$(EXEEXT): $(test_searpc_OBJECTS) $(test_searpc_DEPENDENCIES)
@rm -f test-searpc$(EXEEXT)
$(test_searpc_LINK) $(test_searpc_OBJECTS) $(test_searpc_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-searpc.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
list=' $(TESTS) '; \
$(am__tty_colors); \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*[\ \ ]$$tst[\ \ ]*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
col=$$red; res=XPASS; \
;; \
*) \
col=$$grn; res=PASS; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*[\ \ ]$$tst[\ \ ]*) \
xfail=`expr $$xfail + 1`; \
col=$$lgn; res=XFAIL; \
;; \
*) \
failed=`expr $$failed + 1`; \
col=$$red; res=FAIL; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
col=$$blu; res=SKIP; \
fi; \
echo "$${col}$$res$${std}: $$tst"; \
done; \
if test "$$all" -eq 1; then \
tests="test"; \
All=""; \
else \
tests="tests"; \
All="All "; \
fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="$$All$$all $$tests passed"; \
else \
if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all $$tests failed"; \
else \
if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
if test "$$skip" -eq 1; then \
skipped="($$skip test was not run)"; \
else \
skipped="($$skip tests were not run)"; \
fi; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
if test "$$failed" -eq 0; then \
echo "$$grn$$dashes"; \
else \
echo "$$red$$dashes"; \
fi; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes$$std"; \
test "$$failed" -eq 0; \
else :; fi
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 "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$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
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile
installdirs:
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)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_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-checkPROGRAMS clean-generic clean-libtool \
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
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
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:
.MAKE: check-am install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool 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-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip 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
# 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:

273
tests/test-searpc.c Normal file
View File

@@ -0,0 +1,273 @@
#include <glib.h>
#include <string.h>
#include "searpc-server.h"
#include "searpc-client.h"
#include <glib-object.h>
#define MAMAN_TYPE_BAR (maman_bar_get_type ())
#define MAMAN_BAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MAMAN_TYPE_BAR, MamanBar))
#define MAMAN_IS_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MAMAN_TYPE_BAR))
#define MAMAN_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MAMAN_TYPE_BAR, MamanBarClass))
#define MAMAN_IS_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MAMAN_TYPE_BAR))
#define MAMAN_BAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MAMAN_TYPE_BAR, MamanBarClass))
typedef struct _MamanBar MamanBar;
typedef struct _MamanBarClass MamanBarClass;
struct _MamanBar
{
GObject parent_instance;
gchar *name;
int papa_number;
};
struct _MamanBarClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE (MamanBar, maman_bar, G_TYPE_OBJECT);
enum
{
PROP_0,
PROP_MAMAN_NAME,
PROP_PAPA_NUMBER
};
static void
maman_bar_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
MamanBar *self = MAMAN_BAR (object);
switch (property_id) {
case PROP_MAMAN_NAME:
g_free (self->name);
self->name = g_value_dup_string (value);
g_print ("maman: %s\n", self->name);
break;
case PROP_PAPA_NUMBER:
self->papa_number = g_value_get_uchar (value);
g_print ("papa: %u\n", self->papa_number);
break;
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
maman_bar_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
MamanBar *self = MAMAN_BAR (object);
switch (property_id) {
case PROP_MAMAN_NAME:
g_value_set_string (value, self->name);
break;
case PROP_PAPA_NUMBER:
g_value_set_uchar (value, self->papa_number);
break;
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
maman_bar_class_init (MamanBarClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GParamSpec *pspec;
gobject_class->set_property = maman_bar_set_property;
gobject_class->get_property = maman_bar_get_property;
pspec = g_param_spec_string ("name",
"Maman name",
"Set maman's name",
"no-name-set" /* default value */,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_MAMAN_NAME,
pspec);
pspec = g_param_spec_uchar ("papa-number",
"Number of current Papa",
"Set/Get papa's number",
0 /* minimum value */,
10 /* maximum value */,
2 /* default value */,
G_PARAM_READWRITE);
g_object_class_install_property (gobject_class,
PROP_PAPA_NUMBER,
pspec);
}
static void
maman_bar_init (MamanBar *self)
{
}
/* test function define macro */
SEARPC_CLIENT_DEFUN_INT__STRING(func4);
SEARPC_CLIENT_DEFUN_INT__STRING_STRING(func1);
SEARPC_CLIENT_DEFUN_STRING__VOID(func0);
SEARPC_CLIENT_DEFUN_OBJECT__STRING(func2, 0);
SEARPC_CLIENT_DEFUN_OBJLIST__STRING_INT(func3, 0);
gchar *
get_substring (const gchar *orig_str, int sub_len, GError **error)
{
if (sub_len > strlen(orig_str)) {
g_set_error (error, 0, 100,
"Substring length larger than the length of origin string");
return NULL;
}
gchar *ret = g_malloc0(sub_len+1);
memcpy(ret, orig_str, sub_len);
ret[sub_len] = '\0';
return ret;
}
void test_simple_call (void *fixture, const void *data)
{
char *fcall, *fret;
gsize fcall_len, ret_len;
gchar* result;
GError *error = NULL;
fcall = searpc_client_fcall__string_int ("get_substring", "hello", 2,
&fcall_len);
fret = searpc_server_call_function (fcall, fcall_len, &ret_len);
result = searpc_client_fret__string (fret, ret_len, &error);
g_assert (strcmp(result, "he") == 0);
g_free (result);
/* error should return */
fcall = searpc_client_fcall__string_int ("get_substring", "hello", 7,
&fcall_len);
fret = searpc_server_call_function (fcall, fcall_len, &ret_len);
result = searpc_client_fret__string (fret, ret_len, &error);
g_assert (error->message);
}
GObject *
get_maman_bar(const char *name, GError **error)
{
return g_object_new(MAMAN_TYPE_BAR, "name", name, NULL);
}
void test_object_call (void *fixture, const void *data)
{
char *fcall, *fret;
gsize fcall_len, ret_len;
GObject *result;
GError *error = NULL;
fcall = searpc_client_fcall__string ("get_maman_bar", "kitty",
&fcall_len);
fret = searpc_server_call_function (fcall, fcall_len, &ret_len);
result = searpc_client_fret__object (MAMAN_TYPE_BAR, fret, ret_len, &error);
}
GList *
get_maman_bar_list (const char *name, int num, GError **error)
{
char buf[256];
GList *ret = 0;
int i;
GObject *obj;
if (num < 0) {
g_set_error (error, 0, 100, "num must be positive.");
return NULL;
}
if (num > 1000) {
g_set_error (error, 0, 100, "num must no larger than 1000.");
return NULL;
}
for (i = 0; i < num; i++) {
sprintf (buf, "%s%d", name, i);
obj = g_object_new(MAMAN_TYPE_BAR, "name", buf, NULL);
ret = g_list_prepend (ret, obj);
}
ret = g_list_reverse (ret);
return ret;
}
void test_objlist_call (void *fixture, const void *data)
{
char *fcall, *fret;
gsize fcall_len, ret_len;
GList *result, *ptr;
GError *error = NULL;
fcall = searpc_client_fcall__string_int ("get_maman_bar_list", "kitty", 10,
&fcall_len);
fret = searpc_server_call_function (fcall, fcall_len, &ret_len);
result = searpc_client_fret__objlist (MAMAN_TYPE_BAR, fret, ret_len, &error);
for (ptr = result; ptr; ptr = ptr->next)
g_object_unref (ptr->data);
g_list_free (result);
fcall = searpc_client_fcall__string_int ("get_maman_bar_list", "kitty", 0,
&fcall_len);
fret = searpc_server_call_function (fcall, fcall_len, &ret_len);
result = searpc_client_fret__objlist (MAMAN_TYPE_BAR, fret, ret_len, &error);
}
int
main (int argc, char *argv[])
{
g_type_init ();
g_test_init (&argc, &argv, NULL);
searpc_server_init ();
searpc_server_register_function (get_substring, "get_substring",
searpc_signature_string__string_int());
searpc_server_register_function (get_maman_bar, "get_maman_bar",
searpc_signature_object__string());
searpc_server_register_function (get_maman_bar_list, "get_maman_bar_list",
searpc_signature_objlist__string_int());
g_test_add ("/searpc/simple", void, NULL,
NULL, test_simple_call, NULL);
/* test twice to detect memory error, for example, freed twice */
g_test_add ("/searpc/simple2", void, NULL,
NULL, test_simple_call, NULL);
g_test_add ("/searpc/object", void, NULL,
NULL, test_object_call, NULL);
g_test_add ("/searpc/objlist", void, NULL,
NULL, test_objlist_call, NULL);
return g_test_run();
}

22
tests/test_pysearpc.py Normal file
View File

@@ -0,0 +1,22 @@
import sys
sys.path += ['..', '../pysearpc/.libs']
from pysearpc import SearpcClient, searpc_func, SearpcError
import fcallfret
class SampleRpcClient(SearpcClient):
def call_remote_func_sync(self, fcall_str):
return ""
@searpc_func("void", ["string"])
def list_peers(self):
pass
fcallfret.fcall__string("list", "hello")
client = SampleRpcClient()
client.list_peers("10")