Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] Re: (PR#7038) missing distributed files
Home

[Freeciv-Dev] Re: (PR#7038) missing distributed files

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7038) missing distributed files
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Thu, 4 Dec 2003 14:23:15 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7038 >

On Wed, Dec 03, 2003 at 09:15:26PM -0800, Jason Short wrote:
> 
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=7038 >
> 
> In addition to server/handgen.h, there are two more files missing from 
> the distribution: server/srv_main_gen.c and client/packhand.h.
> 
> In the case of server/srv_main_gen.c we have a problem.  This is not a 
> .c file so it can't be added to SOURCES or it'll be compiled.  It should 
> be renamed as a .h file and added to the sources.  Adding it to 
> EXTRA_DIST should work, but (1) is a huge hack and (2) doesn't seem to 
> work in practice (make still tries to build it).
> 
> The attached patch should work (but doesn't seem to).  To test, apply 
> it, rerun autogen.sh, and run "make distcheck".  Or you can run "make 
> dist", then take the resulting tarball (in the top-level source 
> directory) and just try to build it.
> 
> Until this is fixed it isn't possible to create tarballs.  Very bad.

server/srv_main_gen.c and client/civclient_gen.c were transformed into
real C-file for seperate complication. There were also renamed to
match with the header files. So we have now:

server/hand_gen.[ch] and client/packhand_gen.[ch]

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "This is Linux Country. On a quiet night, you can hear Windows reboot."

Index: client/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/Makefile.am,v
retrieving revision 1.52
diff -u -u -d -r1.52 Makefile.am
--- client/Makefile.am  2003/12/04 05:54:49     1.52
+++ client/Makefile.am  2003/12/04 22:15:17
@@ -109,8 +109,6 @@
                gui-mui/worklistclass.c          \
                gui-mui/worklistclass.h          \
                \
-               civclient_gen.c                  \
-               \
                $(ALL_ESD_FILES)                 \
                $(ALL_SDL_FILES)                 \
                $(ALL_WINMM_FILES)               \
@@ -167,6 +165,7 @@
        packhand.c      \
        packhand.h      \
        packhand_gen.h  \
+       packhand_gen.c  \
        plrdlg_common.c \
        plrdlg_common.h \
        options.c       \
Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.183
diff -u -u -d -r1.183 civclient.c
--- client/civclient.c  2003/12/01 19:32:04     1.183
+++ client/civclient.c  2003/12/04 22:15:17
@@ -270,16 +270,9 @@
 **************************************************************************/
 void handle_packet_input(void *packet, int type)
 {
-  switch(type) {
-    /* 
-     * We now include a number of case statements. Each statement
-     * calls the corresponding handle_packet_* function. 
-     */
-#include "civclient_gen.c"
-
-  default:
-    freelog(LOG_ERROR, "Received unknown packet (type %d) from server!", type);
-    break;
+  if (!client_handle_packet(type, packet)) {
+    freelog(LOG_ERROR, "Received unknown packet (type %d) from server!",
+           type);
   }
 
   free(packet);
Index: common/generate_packets.py
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/generate_packets.py,v
retrieving revision 1.2
diff -u -u -d -r1.2 generate_packets.py
--- common/generate_packets.py  2003/11/30 17:37:29     1.2
+++ common/generate_packets.py  2003/12/04 22:15:18
@@ -1422,6 +1422,15 @@
 #ifndef FC__HAND_GEN_H
 #define FC__HAND_GEN_H
 
+struct player;
+struct connection;
+
+#include "packets.h"
+#include "shared.h"
+
+bool server_handle_packet(enum packet_type type, void *packet,
+                         struct player *pplayer, struct connection *pconn);
+
 ''')
     
     for p in packets:
@@ -1447,6 +1456,16 @@
     f.close()
 
     f=my_open("../client/packhand_gen.h")
+    f.write('''
+#ifndef FC__PACKHAND_GEN_H
+#define FC__PACKHAND_GEN_H
+
+#include "packets.h"
+#include "shared.h"
+
+bool client_handle_packet(enum packet_type type, void *packet);
+
+''')
     for p in packets:
         if "sc" not in p.dirs: continue
 
@@ -1462,9 +1481,23 @@
             f.write('void handle_%s(struct %s *packet);\n'%(a,p.name))
         else:
             f.write('void handle_%s(%s);\n'%(a,b))
+    f.write('''
+#endif /* FC__PACKHAND_GEN_H */
+''')
     f.close()
 
-    f=my_open("../server/srv_main_gen.c")
+    f=my_open("../server/hand_gen.c")
+    f.write('''
+
+#include "packets.h"
+
+#include "hand_gen.h"
+    
+bool server_handle_packet(enum packet_type type, void *packet,
+                         struct player *pplayer, struct connection *pconn)
+{
+  switch(type) {
+''')
     for p in packets:
         if "cs" not in p.dirs: continue
         if p.no_handle: continue
@@ -1490,12 +1523,27 @@
 
         f.write('''  case %s:
     handle_%s(%s);
-    break;
+    return TRUE;
 
 '''%(p.type,a,args))
+    f.write('''  default:
+    return FALSE;
+  }
+}
+''')
     f.close()
 
-    f=my_open("../client/civclient_gen.c")
+    f=my_open("../client/packhand_gen.c")
+    f.write('''
+
+#include "packets.h"
+
+#include "packhand_gen.h"
+    
+bool client_handle_packet(enum packet_type type, void *packet)
+{
+  switch(type) {
+''')
     for p in packets:
         if "sc" not in p.dirs: continue
         if p.no_handle: continue
@@ -1518,9 +1566,14 @@
 
         f.write('''  case %s:
     handle_%s(%s);
-    break;
+    return TRUE;
 
 '''%(p.type,a,args))
+    f.write('''  default:
+    return FALSE;
+  }
+}
+''')
     f.close()
 
 main()
Index: server/Makefile.am
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/Makefile.am,v
retrieving revision 1.31
diff -u -u -d -r1.31 Makefile.am
--- server/Makefile.am  2003/12/04 05:54:49     1.31
+++ server/Makefile.am  2003/12/04 22:15:23
@@ -42,6 +42,7 @@
                handchat.c      \
                handchat.h      \
                hand_gen.h      \
+               hand_gen.c      \
                mapgen.c        \
                mapgen.h        \
                maphand.c       \
@@ -74,10 +75,6 @@
                unithand.h      \
                unittools.c     \
                unittools.h
-
-# HACK HACK HACK: this is not really a .c file, so we can't add it to the
-# SOURCES list.  It should be a .h file.  See also civclient_gen.c.
-EXTRA_DIST = srv_main_gen.c
 
 civserver_DEPENDENCIES = ../common/libcivcommon.a ../ai/libcivai.a 
./libcivserver.a ../common/aicore/libaicore.a $(USER_DB_DEP)
 civserver_LDADD        = ../common/libcivcommon.a ../ai/libcivai.a 
./libcivserver.a @INTLLIBS@ ../common/libcivcommon.a ../ai/libcivai.a 
./libcivserver.a ../common/aicore/libaicore.a $(USER_DB_LIB) $(SERVER_LIBS)
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.148
diff -u -u -d -r1.148 srv_main.c
--- server/srv_main.c   2003/11/30 17:57:12     1.148
+++ server/srv_main.c   2003/12/04 22:15:24
@@ -850,13 +850,7 @@
   /* Make sure to set this back to NULL before leaving this function: */
   pplayer->current_conn = pconn;
 
-  switch (type) {
-    /* 
-     * We now include a number of case statements. Each statement
-     * calls the corresponding handle_packet_* function. 
-     */
-#include "srv_main_gen.c"
-  default:
+  if (!server_handle_packet(type, packet, pplayer, pconn)) {
     freelog(LOG_ERROR, "Received unknown packet %d from %s",
            type, conn_description(pconn));
   }

[Prev in Thread] Current Thread [Next in Thread]