[Spice-commits] Branch 'wip2' - 4 commits - common/Makefile.am configure.ac Makefile.am python_modules/marshal.py spice_codegen.py

Marc-André Lureau elmarco at kemper.freedesktop.org
Tue Mar 20 17:47:53 PDT 2012


 Makefile.am               |    1 +
 common/Makefile.am        |   45 +++++++++++++++++++++++++++++++++++++++------
 configure.ac              |    7 +++++++
 python_modules/marshal.py |   11 +++++++----
 spice_codegen.py          |    3 ++-
 5 files changed, 56 insertions(+), 11 deletions(-)

New commits:
commit 897997379d4f53482309d9fe524172b769671d43
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Wed Mar 21 01:46:44 2012 +0100

    codegen: ifdef/endif function declaration too
    
    Compile out part that we are not supporting.  In the future, we might
    want to declare a fake type and an empty function to keep API
    compatibility

diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index 8cbc426..4020799 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -378,6 +378,7 @@ def write_protocol_marshaller(writer, proto, is_server, private_marshallers):
         channel = c.channel_type
         if channel.has_attr("ifdef"):
             writer.ifdef(channel.attributes["ifdef"][0])
+            writer.header.ifdef(channel.attributes["ifdef"][0])
         if is_server:
             for m in channel.client_messages:
                 message = m.message_type
@@ -400,6 +401,7 @@ def write_protocol_marshaller(writer, proto, is_server, private_marshallers):
                     functions[f] = True
         if channel.has_attr("ifdef"):
             writer.endif(channel.attributes["ifdef"][0])
+            writer.header.endif(channel.attributes["ifdef"][0])
 
     if private_marshallers:
         scope = writer.function("spice_message_marshallers_get" +  writer.public_prefix,
commit e5a9a9fef3f90f70a0bf4d754539faba48736843
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Wed Mar 21 01:45:04 2012 +0100

    codegen: include headers locally

diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index dc10a4c..8cbc426 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -4,7 +4,7 @@ import codegen
 
 def write_includes(writer):
     writer.header.writeln("#include <spice/protocol.h>")
-    writer.header.writeln("#include <marshaller.h>")
+    writer.header.writeln('#include "marshaller.h"')
     writer.header.newline()
     writer.header.writeln("#ifndef _GENERATED_HEADERS_H")
     writer.header.writeln("#define _GENERATED_HEADERS_H")
@@ -15,7 +15,7 @@ def write_includes(writer):
     writer.writeln("#include <stdio.h>")
     writer.writeln("#include <spice/protocol.h>")
     writer.writeln("#include <spice/macros.h>")
-    writer.writeln("#include <marshaller.h>")
+    writer.writeln('#include "marshaller.h"')
     writer.newline()
     writer.writeln("#ifdef _MSC_VER")
     writer.writeln("#pragma warning(disable:4101)")
diff --git a/spice_codegen.py b/spice_codegen.py
index 759b09d..e9e64c0 100755
--- a/spice_codegen.py
+++ b/spice_codegen.py
@@ -157,6 +157,7 @@ if options.print_error:
 
 if options.includes:
     for i in options.includes:
+        writer.header.writeln('#include "%s"' % i)
         writer.writeln('#include "%s"' % i)
 
 if options.generate_enums:
commit 3c170c73fff6bc61d3d6e15b6c128a411ccdbde6
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Wed Mar 21 01:43:29 2012 +0100

    codegen: struct marshallers are not current function helper
    
    This solves the issue of struct_marshallers being included within the
    current ifdef/endif body, although they are independant functions.

diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index d93f983..dc10a4c 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -99,7 +99,7 @@ class SubMarshallingSource(MarshallingSource):
         else:
             return self.parent_src.get_ref(self.name) + "." + member
 
-def write_marshal_ptr_function(writer, target_type):
+def write_marshal_ptr_function(writer, target_type, is_helper=True):
     if target_type.is_array():
         marshal_function = "spice_marshall_array_%s" % target_type.element_type.primitive_type()
     else:
@@ -116,7 +116,8 @@ def write_marshal_ptr_function(writer, target_type):
         names_args = "".join(n)
 
     header = writer.header
-    writer = writer.function_helper()
+    if is_helper:
+        writer = writer.function_helper()
     writer.header = header
     writer.out_prefix = ""
     if target_type.is_array():
diff --git a/spice_codegen.py b/spice_codegen.py
index a9fdee9..759b09d 100755
--- a/spice_codegen.py
+++ b/spice_codegen.py
@@ -188,7 +188,7 @@ if options.generate_marshallers:
 if options.struct_marshallers:
     for structname in options.struct_marshallers:
         t = ptypes.lookup_type(structname)
-        marshal.write_marshal_ptr_function(writer, t)
+        marshal.write_marshal_ptr_function(writer, t, False)
 
 if options.generate_marshallers or (options.struct_marshallers and len(options.struct_marshallers) > 0):
     marshal.write_trailer(writer)
commit ddcfcf364e8789b6181fb40dc3c7dde423485f76
Author: Marc-André Lureau <marcandre.lureau at gmail.com>
Date:   Tue Mar 20 23:41:45 2012 +0100

    Build libspice-common-server.la with server marshallers
    
    Workaround SMARTCARD support with dirty hack...

diff --git a/Makefile.am b/Makefile.am
index cd30d84..28450b4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,5 @@
 NULL =
+ACLOCAL_AMFLAGS = -I m4
 
 SUBDIRS = python_modules common
 DIST_SUBDIRS = spice-protocol $(SUBDIRS)
diff --git a/common/Makefile.am b/common/Makefile.am
index 46626e6..f2774e4 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -8,9 +8,15 @@ MARSHALLERS =					\
 	generated_marshallers1.c		\
 	$(NULL)
 
-BUILT_SOURCES = $(MARSHALLERS)
+SERVER_MARSHALLERS =				\
+	generated_server_demarshallers.c	\
+	generated_server_marshallers.c		\
+	generated_server_marshallers.h		\
+	$(NULL)
+
+BUILT_SOURCES = $(MARSHALLERS) $(SERVER_MARSHALLERS)
 
-noinst_LTLIBRARIES = libspice-common.la
+noinst_LTLIBRARIES = libspice-common.la libspice-common-server.la
 libspice_common_la_SOURCES =		\
 	$(MARSHALLERS)			\
 	backtrace.c			\
@@ -52,6 +58,12 @@ libspice_common_la_SOURCES =		\
 	ssl_verify.h			\
 	$(NULL)
 
+libspice_common_server_la_SOURCES =		\
+	$(SERVER_MARSHALLERS)			\
+	$(NULL)
+
+libspice_common_server_la_CFLAGS = -DFIXME_SERVER_SMARTCARD
+
 if SUPPORT_GL
 libspice_common_la_SOURCES +=		\
 	gl_utils.h			\
@@ -72,20 +84,41 @@ AM_CPPFLAGS =				\
 	-std=gnu99			\
 	$(NULL)
 
+MARSHALLERS_DEPS =					\
+	$(top_srcdir)/python_modules/__init__.py	\
+	$(top_srcdir)/python_modules/codegen.py		\
+	$(top_srcdir)/python_modules/demarshal.py	\
+	$(top_srcdir)/python_modules/marshal.py		\
+	$(top_srcdir)/python_modules/ptypes.py		\
+	$(top_srcdir)/python_modules/spice_parser.py	\
+	$(top_srcdir)/spice_codegen.py			\
+	Makefile					\
+	$(NULL)
+
 # Note despite being autogenerated these are not part of CLEANFILES, they are
 # actually a part of EXTRA_DIST, to avoid the need for pyparser by end users
-generated_demarshallers.c: $(top_srcdir)/spice.proto
+generated_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h $< $@ >/dev/null
 
-generated_demarshallers1.c: $(top_srcdir)/spice1.proto
+generated_demarshallers1.c: $(top_srcdir)/spice1.proto $(MARSHALLERS_DEPS)
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --client --include messages.h --prefix 1 --ptrsize 8 $< $@ >/dev/null
 
-generated_marshallers.c: $(top_srcdir)/spice.proto
+generated_marshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include client_marshallers.h --client $< $@ >/dev/null
 
-generated_marshallers1.c: $(top_srcdir)/spice1.proto
+generated_marshallers1.c: $(top_srcdir)/spice1.proto $(MARSHALLERS_DEPS)
 	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers -P --include messages.h --include client_marshallers.h --client --prefix 1 --ptrsize 8 $< $@ >/dev/null
 
+generated_server_demarshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-demarshallers --server --include messages.h $< $@ >/dev/null
+
+STRUCTS = -M String -M Rect -M Point -M DisplayBase -M Fill -M Opaque -M Copy -M Blend -M Blackness -M Whiteness -M Invers -M Rop3 -M Stroke -M Text -M Transparent -M AlphaBlend
+generated_server_marshallers.c: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include messages.h $< $@ >/dev/null
+
+generated_server_marshallers.h: $(top_srcdir)/spice.proto $(MARSHALLERS_DEPS)
+	$(AM_V_GEN)$(PYTHON) $(top_srcdir)/spice_codegen.py --generate-marshallers $(STRUCTS) --server --include messages.h -H $< $@ >/dev/null
+
 EXTRA_DIST =				\
 	$(MARSHALLERS)			\
 	canvas_base.c			\
diff --git a/configure.ac b/configure.ac
index 4f6942e..1178069 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,4 +110,11 @@ AC_CONFIG_FILES([
   python_modules/Makefile
 ])
 
+AH_BOTTOM([
+/* argh.. this is evil */
+#if defined(FIXME_SERVER_SMARTCARD) && defined(USE_SMARTCARD)
+%:undef USE_SMARTCARD
+#endif
+])
+
 AC_OUTPUT


More information about the Spice-commits mailing list