Author: cazfi
Date: Tue May 23 19:11:08 2017
New Revision: 35699

URL: http://svn.gna.org/viewcvs/freeciv?rev=35699&view=rev
Log:
Add 'parser.lua' to rulesets

See hrm Feature #661644

Added:
    trunk/data/alien/parser.lua
    trunk/data/civ1/parser.lua
    trunk/data/civ2/parser.lua
    trunk/data/civ2civ3/parser.lua
    trunk/data/classic/parser.lua
    trunk/data/experimental/parser.lua
    trunk/data/multiplayer/parser.lua
    trunk/data/sandbox/parser.lua
    trunk/data/stub/parser.lua
    trunk/data/webperimental/parser.lua
Modified:
    trunk/data/alien/Makefile.am
    trunk/data/civ1/Makefile.am
    trunk/data/civ2/Makefile.am
    trunk/data/civ2civ3/Makefile.am
    trunk/data/classic/Makefile.am
    trunk/data/multiplayer/Makefile.am
    trunk/data/sandbox/Makefile.am
    trunk/server/ruleset.c
    trunk/server/ruleset.h
    trunk/tools/ruleutil/rulesave.c

Modified: trunk/data/alien/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/Makefile.am?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/data/alien/Makefile.am        (original)
+++ trunk/data/alien/Makefile.am        Tue May 23 19:11:08 2017
@@ -9,6 +9,7 @@
        effects.ruleset         \
        nation_effects.ruleset  \
        script.lua              \
+       parser.lua              \
        styles.ruleset          \
        game.ruleset            \
        governments.ruleset     \

Added: trunk/data/alien/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/alien/parser.lua (added)
+++ trunk/data/alien/parser.lua Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/data/civ1/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/Makefile.am?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/data/civ1/Makefile.am (original)
+++ trunk/data/civ1/Makefile.am Tue May 23 19:11:08 2017
@@ -8,6 +8,7 @@
        cities.ruleset  \
        effects.ruleset \
        script.lua      \
+       parser.lua      \
        styles.ruleset  \
        game.ruleset    \
        governments.ruleset \

Added: trunk/data/civ1/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/civ1/parser.lua  (added)
+++ trunk/data/civ1/parser.lua  Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/data/civ2/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/Makefile.am?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/data/civ2/Makefile.am (original)
+++ trunk/data/civ2/Makefile.am Tue May 23 19:11:08 2017
@@ -8,6 +8,7 @@
        cities.ruleset  \
        effects.ruleset \
        script.lua      \
+       parser.lua      \
        styles.ruleset  \
        game.ruleset    \
        governments.ruleset \

Added: trunk/data/civ2/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/civ2/parser.lua  (added)
+++ trunk/data/civ2/parser.lua  Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/data/civ2civ3/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/Makefile.am?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/data/civ2civ3/Makefile.am     (original)
+++ trunk/data/civ2civ3/Makefile.am     Tue May 23 19:11:08 2017
@@ -8,6 +8,7 @@
        cities.ruleset  \
        effects.ruleset \
        script.lua      \
+       parser.lua      \
        styles.ruleset  \
        game.ruleset    \
        governments.ruleset \

Added: trunk/data/civ2civ3/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/civ2civ3/parser.lua      (added)
+++ trunk/data/civ2civ3/parser.lua      Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/data/classic/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/Makefile.am?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/data/classic/Makefile.am      (original)
+++ trunk/data/classic/Makefile.am      Tue May 23 19:11:08 2017
@@ -11,6 +11,7 @@
        governments.ruleset     \
        nations.ruleset         \
        script.lua              \
+       parser.lua              \
        styles.ruleset          \
        techs.ruleset           \
        terrain.ruleset         \

Added: trunk/data/classic/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/classic/parser.lua       (added)
+++ trunk/data/classic/parser.lua       Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Added: trunk/data/experimental/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/experimental/parser.lua  (added)
+++ trunk/data/experimental/parser.lua  Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/data/multiplayer/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/Makefile.am?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/data/multiplayer/Makefile.am  (original)
+++ trunk/data/multiplayer/Makefile.am  Tue May 23 19:11:08 2017
@@ -8,6 +8,7 @@
        cities.ruleset  \
        effects.ruleset \
        script.lua      \
+       parser.lua      \
        styles.ruleset  \
        game.ruleset    \
        governments.ruleset \

Added: trunk/data/multiplayer/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/multiplayer/parser.lua   (added)
+++ trunk/data/multiplayer/parser.lua   Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/data/sandbox/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/Makefile.am?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/data/sandbox/Makefile.am      (original)
+++ trunk/data/sandbox/Makefile.am      Tue May 23 19:11:08 2017
@@ -8,6 +8,7 @@
        cities.ruleset  \
        effects.ruleset \
        script.lua      \
+       parser.lua      \
        styles.ruleset  \
        game.ruleset    \
        governments.ruleset \

Added: trunk/data/sandbox/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/sandbox/parser.lua       (added)
+++ trunk/data/sandbox/parser.lua       Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Added: trunk/data/stub/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/stub/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/stub/parser.lua  (added)
+++ trunk/data/stub/parser.lua  Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Added: trunk/data/webperimental/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/parser.lua?rev=35699&view=auto
==============================================================================
--- trunk/data/webperimental/parser.lua (added)
+++ trunk/data/webperimental/parser.lua Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Tue May 23 19:11:08 2017
@@ -194,6 +194,7 @@
                                  size_t err_len);
 
 char *script_buffer = NULL;
+char *parser_buffer = NULL;
 
 /**************************************************************************
   Notifications about ruleset errors to clients. Especially important in
@@ -267,6 +268,14 @@
 char *get_script_buffer(void)
 {
   return script_buffer;
+}
+
+/**************************************************************************
+  Return current parser.lua buffer.
+**************************************************************************/
+char *get_parser_buffer(void)
+{
+  return parser_buffer;
 }
 
 /**************************************************************************
@@ -8021,6 +8030,10 @@
     FC_FREE(script_buffer);
     script_buffer = NULL;
   }
+  if (parser_buffer != NULL) {
+    FC_FREE(parser_buffer);
+    parser_buffer = NULL;
+  }
 
   server.playable_nations = 0;
 
@@ -8158,7 +8171,6 @@
   }
 
   if (ok) {
-    
     char **buffer = buffer_script ? &script_buffer : NULL;
 
     script_server_free();
@@ -8166,6 +8178,12 @@
     script_server_init();
 
     ok = openload_script_file("script", rsdir, buffer);
+  }
+
+  if (ok) {
+    char **buffer = buffer_script ? &parser_buffer : NULL;
+
+    ok = openload_script_file("parser", rsdir, buffer);
   }
 
   if (ok && !buffer_script) {

Modified: trunk/server/ruleset.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.h?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/server/ruleset.h      (original)
+++ trunk/server/ruleset.h      Tue May 23 19:11:08 2017
@@ -55,6 +55,7 @@
   }
 
 char *get_script_buffer(void);
+char *get_parser_buffer(void);
 
 /* Default ruleset values that are not settings (in game.h) */
 

Modified: trunk/tools/ruleutil/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleutil/rulesave.c?rev=35699&r1=35698&r2=35699&view=diff
==============================================================================
--- trunk/tools/ruleutil/rulesave.c     (original)
+++ trunk/tools/ruleutil/rulesave.c     Tue May 23 19:11:08 2017
@@ -2802,10 +2802,9 @@
 /**************************************************************************
   Save script.lua
 **************************************************************************/
-static bool save_script_lua(const char *filename, const char *name)
-{
-  char *buffer = get_script_buffer();
-
+static bool save_script_lua(const char *filename, const char *name,
+                            const char *buffer)
+{
   if (buffer != NULL) {
     FILE *ffile = fc_fopen(filename, "w");
     int full_len = strlen(buffer);
@@ -2888,7 +2887,12 @@
 
     if (success) {
       fc_snprintf(filename, sizeof(filename), "%s/script.lua", path);
-      success = save_script_lua(filename, name);
+      success = save_script_lua(filename, name, get_script_buffer());
+    }
+
+    if (success) {
+      fc_snprintf(filename, sizeof(filename), "%s/parser.lua", path);
+      success = save_script_lua(filename, name, get_parser_buffer());
     }
 
     return success;


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to