adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: adonthell/src/tools/dlgedit Makefile.am,1.52,1.


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/tools/dlgedit Makefile.am,1.52,1.53 dlg_arrow.cc,1.7,1.8 dlg_circle.h,1.7,1.8 dlg_module.cc,1.13,1.14 dlg_module.h,1.13,1.14 gui_dlgedit.cc,1.12,1.13 lex.loadlg.cc,1.16,1.17 loadlg.l,1.13,1.14
Date: Wed, 01 Jan 2003 14:26:13 -0500

Update of /cvsroot/adonthell/adonthell/src/tools/dlgedit
In directory subversions:/tmp/cvs-serv5909

Modified Files:
        Makefile.am dlg_arrow.cc dlg_circle.h dlg_module.cc 
        dlg_module.h gui_dlgedit.cc lex.loadlg.cc loadlg.l 
Log Message:
RESTORED compatibility with old dialogue source files
FIXED loading/saving of dialogues with submodules 


Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/Makefile.am,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -r1.52 -r1.53
*** Makefile.am 27 Dec 2002 21:54:20 -0000      1.52
--- Makefile.am 1 Jan 2003 19:26:10 -0000       1.53
***************
*** 84,88 ****
  
  # Evil, but it works...
! CPPFLAGS =-I../.. -D_VERSION_=\"0.8\" $(GTK_CFLAGS) $(SDL_CFLAGS)
  
  # SWIGFLAGS = -D_DLGEDIT_ -D_DEBUG_
--- 84,88 ----
  
  # Evil, but it works...
! CPPFLAGS =-I../.. -D_VERSION_=\"0.9pre\" $(GTK_CFLAGS) $(SDL_CFLAGS)
  
  # SWIGFLAGS = -D_DLGEDIT_ -D_DEBUG_
***************
*** 99,106 ****
  lex.loadcfg.cc: loadcfg.l
        flex -olex.loadcfg.cc loadcfg.l
- 
- # py_character_wrap.cc : py_character.i ../../character.h 
../../character_base.h
- #     swig $(SWIGFLAGS) -python -shadow -c++ -make_default -o 
py_character_wrap.cc $<
- 
- # py_quest_wrap.cc : py_quest.i ../../quest.h
- #     swig $(SWIGFLAGS) -python -shadow -c++ -make_default -o 
py_quest_wrap.cc $<
--- 99,100 ----

Index: dlg_arrow.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_arrow.cc,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** dlg_arrow.cc        9 Nov 2002 21:47:02 -0000       1.7
--- dlg_arrow.cc        1 Jan 2003 19:26:10 -0000       1.8
***************
*** 238,242 ****
  bool DlgArrow::load (DlgNode *m)
  {
!     DlgModule *owner, *module = (DlgModule *) m;
      DlgNode *circle;
      std::string str;
--- 238,244 ----
  bool DlgArrow::load (DlgNode *m)
  {
!     DlgModule *module = (DlgModule *) m;
!     DlgModule *owner = module;
!     DlgModule *toplevel = module->toplevel ();
      DlgNode *circle;
      std::string str;
***************
*** 263,290 ****
              }
  
!             // Node prior to arrow
!             case LOAD_PREV:
              {
                  if (parse_dlgfile (str, n) == LOAD_NUM)
                  {
                      // get the module the node belongs to
!                     owner = (DlgModule *) module->getModule (n);
                      
                      // failed
!                     if (owner == NULL || owner->type () != MODULE) 
!                         return false;
!                     
!                     if (parse_dlgfile (str, n) == LOAD_NUM)
                      {
!                         // get the id of the previous circle
!                         circle = owner->getNode (n);
                          
!                         // failed
!                         if (circle == NULL) return false;
                      }
-                     
-                     // everything okay, so add circle
-                     prev_.push_back (circle);
                  }
                  
                  break;
--- 265,306 ----
              }
  
!             // Module node belongs to
!             case LOAD_MODULE:
              {
                  if (parse_dlgfile (str, n) == LOAD_NUM)
                  {
                      // get the module the node belongs to
!                     owner = toplevel->getModule (n);
                      
                      // failed
!                     if (!owner || owner->type () != MODULE)
                      {
!                         cout << "DlgArrow::load: failed to getModule (" 
!                              << n << ")!" << endl;
                          
!                         return false;
                      }
                  }
+                  
+                 break;
+             }
+             
+             // Node prior to arrow
+             case LOAD_PREV:
+             {
+                 if (parse_dlgfile (str, n) == LOAD_NUM)
+                 {
+                     // get the id of the previous circle
+                     circle = owner->getNode (n);
+                         
+                     // failed
+                     if (circle == NULL) return false;
+                 }
+                     
+                 // everything okay, so add circle
+                 prev_.push_back (circle);
+                 
+                 // restore owner
+                 owner = module;
                  
                  break;
***************
*** 296,318 ****
                  if (parse_dlgfile (str, n) == LOAD_NUM)
                  {
!                     // get the module the node belongs to
!                     owner = (DlgModule *) module->getModule (n);
!                     
!                     // failed
!                     if (owner == NULL || owner->type () != MODULE) 
!                         return false;
!                     
!                     if (parse_dlgfile (str, n) == LOAD_NUM)
!                     {
!                         // get the id of the previous circle
!                         circle = owner->getNode (n);
                          
!                         // failed
!                         if (circle == NULL) return false;
!                     }
!                     
!                     // everything okay, so add circle
!                     next_.push_back (circle);
                  }
                  break;
              }
--- 312,328 ----
                  if (parse_dlgfile (str, n) == LOAD_NUM)
                  {
!                     // get the id of the previous circle
!                     circle = owner->getNode (n);
                          
!                     // failed
!                     if (circle == NULL) return false;
                  }
+                     
+                 // everything okay, so add circle
+                 next_.push_back (circle);
+ 
+                 // restore owner
+                 owner = module;
+                 
                  break;
              }
***************
*** 346,357 ****
      file << "\nArrow\n";
  
      // start circle
!     file << "  Prev " << prev_.front ()->module_id () << " "
!          << prev_.front ()->node_id () << "\n";
  
      // end circle
!     file << "  Next " << next_.front ()->module_id () << " "
!          << next_.front ()->node_id () << "\n";
  
      file << "End\n";
  }
--- 356,374 ----
      file << "\nArrow\n";
  
+     // module of start circle, if != 0
+     if (prev_.front ()->module_id () != 0)
+         file << "  Module " << prev_.front ()->module_id () << "\n";
+     
      // start circle
!     file << "  Prev " << prev_.front ()->node_id () << "\n";
! 
!     // module of end circle, if != 0
!     if (next_.front ()->module_id () != 0)
!         file << "  Module " << next_.front ()->module_id () << "\n";
  
      // end circle
!     file << "  Next " << next_.front ()->node_id () << "\n";
  
+     // end of node
      file << "End\n";
  }

Index: dlg_circle.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_circle.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** dlg_circle.h        9 Nov 2002 21:47:02 -0000       1.7
--- dlg_circle.h        1 Jan 2003 19:26:10 -0000       1.8
***************
*** 40,46 ****
      /**
       * Create an empty circle. Used when loading a circle.
!      * @param id The id of the module the circle belongs to.
       */
!     DlgCircle (int id = 0) { mode_ = IDLE; entry_ = NULL; mid_ = id; }
      /**
       * Create a circle with basic information. Used to create a new circle.
--- 40,49 ----
      /**
       * Create an empty circle. Used when loading a circle.
!      * @param mid The id of the module the circle belongs to.
!      * @param nid The id of the circle.
       */
!     DlgCircle (int mid = 0, int nid = 0) 
!     { mode_ = IDLE; entry_ = NULL; mid_ = mid; nid_ = nid; }
! 
      /**
       * Create a circle with basic information. Used to create a new circle.

Index: dlg_module.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** dlg_module.cc       9 Nov 2002 21:47:02 -0000       1.13
--- dlg_module.cc       1 Jan 2003 19:26:10 -0000       1.14
***************
*** 304,308 ****
  bool DlgModule::load ()
  {
!     int i = 1, n;
      DlgCircle *circle;
      DlgArrow *arrow;
--- 304,308 ----
  bool DlgModule::load ()
  {
!     int i = 1, id = 0, n;
      DlgCircle *circle;
      DlgArrow *arrow;
***************
*** 314,322 ****
          switch (i = parse_dlgfile (s, n))
          {
              case LOAD_CIRCLE:
              {
!                 circle = new DlgCircle (nid_);
                  circle->load ();
! 
                  nodes.push_back (circle);
  
--- 314,323 ----
          switch (i = parse_dlgfile (s, n))
          {
+             // load text node
              case LOAD_CIRCLE:
              {
!                 circle = new DlgCircle (nid_, id++);
                  circle->load ();
!                 
                  nodes.push_back (circle);
  
***************
*** 324,332 ****
              }
  
              case LOAD_ARROW:
              {
                  arrow = new DlgArrow;
!                 
!                 if (arrow->load (this->toplevel ()))
                      nodes.push_back (arrow);
  
--- 325,334 ----
              }
  
+             // load arrow node
              case LOAD_ARROW:
              {
                  arrow = new DlgArrow;
! 
!                 if (arrow->load (this))
                      nodes.push_back (arrow);
  
***************
*** 334,367 ****
              }
  
              case LOAD_MODULE:
              {
                  if (parse_dlgfile (s, n) == LOAD_STR)
                  {
!                     // get filename of the submodule
!                     std::string file = path_ + s; 
!                     
!                     // remember position in current file
!                     int filepos = ftell (loadlgin);
! 
!                     // and close it
!                     fclose (loadlgin);
  
!                     // load the subdialogue from it's own file
                      DlgModule *subdlg = GuiDlgedit::window->loadSubdialogue 
(file);
  
!                     // re-open our dialogue file
!                     loadlgin = fopen (fullName ().c_str (), "rb");
!                     if (!loadlgin) return false;
! 
!                     // restore filepointer
!                     fseek (loadlgin, filepos, SEEK_SET);
!                     
!                     // load rest of subdialogue
                      if (subdlg)
!                     { 
                          subdlg->loadSubdialogue ();
                          nodes.push_back (subdlg);
                      }
                  }
                  break;
              }
--- 336,361 ----
              }
  
+             // load submodule node
              case LOAD_MODULE:
              {
                  if (parse_dlgfile (s, n) == LOAD_STR)
                  {
!                     // get filename of submodule
!                     std::string file = path_ + s;
  
!                     // try to create the subdialogue
                      DlgModule *subdlg = GuiDlgedit::window->loadSubdialogue 
(file);
  
!                     // if succeeded, read the final bits
                      if (subdlg)
!                     {
                          subdlg->loadSubdialogue ();
+                         subdlg->setParent (this);
+                         
                          nodes.push_back (subdlg);
                      }
+                     
                  }
+                                 
                  break;
              }
***************
*** 431,435 ****
      }
      
-     fclose (loadlgin);
      return true;
  }
--- 425,428 ----
***************
*** 445,461 ****
          switch (i = parse_dlgfile (s, n))
          {
              case LOAD_END:
!             {
!                 i = 0;
!                 break;
!             }
! 
              case LOAD_ID:
              {
                  if (parse_dlgfile (s, n) == LOAD_NUM) nid_ = n;
- 
                  break;
              }
  
              case LOAD_POS:
              {
--- 438,453 ----
          switch (i = parse_dlgfile (s, n))
          {
+             // module loaded or EOF
              case LOAD_END:
!                 return;
!             
!             // get id of submodule
              case LOAD_ID:
              {
                  if (parse_dlgfile (s, n) == LOAD_NUM) nid_ = n;
                  break;
              }
  
+             // get position of submodule
              case LOAD_POS:
              {
***************
*** 533,540 ****
  void DlgModule::save (std::ofstream &file)
  {
!     std::string path = relativeName ();
!     
!     // the module's relative filename
!     file << "\nModule §" << path << "§\n";
              
      // module's id
--- 525,530 ----
  void DlgModule::save (std::ofstream &file)
  {
!     // module's relative filename
!     file << "\nModule " << relativeName () << "\n";
              
      // module's id

Index: dlg_module.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** dlg_module.h        9 Nov 2002 21:47:02 -0000       1.13
--- dlg_module.h        1 Jan 2003 19:26:10 -0000       1.14
***************
*** 375,379 ****
      DlgModuleEntry entry_;      // further content of the dialogue
  
!     KBTraverse traverse_;       // Keyboard graph traversal   helper
  private:
      void init ();               // initialize a newly constructed DlgModule
--- 375,380 ----
      DlgModuleEntry entry_;      // further content of the dialogue
  
!     KBTraverse traverse_;       // Keyboard graph traversal helper
!     
  private:
      void init ();               // initialize a newly constructed DlgModule

Index: gui_dlgedit.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_dlgedit.cc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** gui_dlgedit.cc      2 Nov 2002 21:35:55 -0000       1.12
--- gui_dlgedit.cc      1 Jan 2003 19:26:10 -0000       1.13
***************
*** 19,23 ****
   * @brief The Dialogue Editor's main window
   */
!  
  #ifdef HAVE_CONFIG_H
  #include <config.h>
--- 19,23 ----
   * @brief The Dialogue Editor's main window
   */
! 
  #ifdef HAVE_CONFIG_H
  #include <config.h>
***************
*** 41,44 ****
--- 41,48 ----
  #include "gui_dlgedit_events.h"
  
+ struct yy_buffer_state;
+ extern void loadlg_switch_to_buffer (yy_buffer_state*);
+ extern yy_buffer_state* loadlg_create_buffer (FILE*, int);
+         
  // Icon of the main window
  static char * icon_xpm[] = {
***************
*** 471,474 ****
--- 475,481 ----
      DlgModule *module = new DlgModule (directory_, filename, "", "");
  
+     // loading successful
+     // loadlg_switch_to_buffer (loadlg_create_buffer (loadlgin, 16384));
+ 
      // try to load from file
      if (!module->load ())
***************
*** 478,484 ****
          return NULL;
      }
- 
-     // loading successful
-     message->display (202);   
  
      // return the sub-dialogue
--- 485,488 ----

Index: lex.loadlg.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/lex.loadlg.cc,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -r1.16 -r1.17
*** lex.loadlg.cc       9 Nov 2002 21:47:02 -0000       1.16
--- lex.loadlg.cc       1 Jan 2003 19:26:10 -0000       1.17
***************
*** 304,323 ****
        yy_c_buf_p = yy_cp;
  
! #define YY_NUM_RULES 32
! #define YY_END_OF_BUFFER 33
! static yyconst short int yy_accept[107] =
      {   0,
!         0,    0,    0,    0,   33,   31,   30,   30,    1,   31,
!        29,   31,   31,   31,   31,   31,   31,   31,   31,   31,
!        31,   31,   31,   31,   31,   26,   28,   27,   30,    1,
!         1,   29,    0,    0,    0,    0,    0,    0,    0,    0,
!        25,    0,    0,    0,    0,    0,    0,    0,    0,    0,
!         0,    0,    0,    0,    0,   28,    0,    0,    0,    0,
!         0,    5,    0,    0,   22,    0,    0,    0,   16,    0,
!         0,    0,   10,    0,    0,    0,    0,    0,    0,    0,
!         0,   13,   24,   23,   15,    0,    9,   20,    0,   17,
!         8,   11,    7,   21,   18,   12,    6,   14,    3,    0,
  
!         0,    0,    2,   19,    4,    0
      } ;
  
--- 304,324 ----
        yy_c_buf_p = yy_cp;
  
! #define YY_NUM_RULES 34
! #define YY_END_OF_BUFFER 35
! static yyconst short int yy_accept[113] =
      {   0,
!         0,    0,    0,    0,    0,    0,   35,   33,   32,   32,
!         1,   33,   31,   33,   33,   33,   33,   33,   33,   33,
!        33,   33,   33,   33,   33,   33,   33,   28,   30,   29,
!        27,   26,   34,   32,    1,    1,   31,    0,    0,    0,
!         0,    0,    0,    0,    0,   24,    0,    0,    0,    0,
!         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
!        30,   27,    0,    0,    0,    0,    0,    4,    0,    0,
!        21,    0,    0,    0,   15,    0,    0,    0,    9,    0,
!         0,    0,    0,    0,    0,    0,    0,   12,   23,   22,
!        14,    0,    8,   19,    0,   16,    7,   10,    6,   20,
  
!        17,   11,    5,   13,    3,    0,    0,    0,    2,   18,
!        25,    0
      } ;
  
***************
*** 356,422 ****
  static yyconst int yy_meta[42] =
      {   0,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
!         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
!         2
      } ;
  
! static yyconst short int yy_base[110] =
      {   0,
!         0,    0,   91,   90,  130,  133,   40,   42,  126,  122,
!       121,   93,   21,   90,   94,   87,   98,   24,   24,   90,
!        36,   17,   99,   34,   98,  133,    0,  133,   59,  115,
!       133,  111,   83,   82,   84,   82,   81,   88,   80,   79,
!       133,   86,   77,   75,   82,   96,   74,   63,   66,   66,
!        35,   77,   59,   65,   63,    0,   64,   72,   70,   59,
!        58,  133,   68,   66,  133,   61,   55,   50,  133,   61,
!        49,   59,  133,   45,   55,   56,   44,   49,   38,   33,
!        42,  133,  133,  133,  133,   45,  133,  133,   40,  133,
!       133,  133,  133,  133,  133,  133,  133,  133,  133,   41,
  
!        31,   39,  133,  133,  133,  133,   74,   76,   50
      } ;
  
! static yyconst short int yy_def[110] =
      {   0,
!       106,    1,  107,  107,  106,  106,  106,  106,  108,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  109,  106,  106,  108,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  109,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
  
!       106,  106,  106,  106,  106,    0,  106,  106,  106
      } ;
  
! static yyconst short int yy_nxt[175] =
      {   0,
!         6,    7,    8,    9,   10,   11,   12,   13,   14,   15,
!        16,   17,   18,   19,   20,   21,   22,   23,   24,   25,
!         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
!         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
!        26,   29,   29,   29,   29,   34,   41,   50,   43,   51,
!        56,   35,   46,   42,   44,   36,   47,   53,   74,   48,
!        29,   29,  105,  104,  103,   75,   49,  102,  101,  100,
!        99,   98,   97,   54,   27,   27,   30,   30,   96,   95,
!        94,   93,   92,   91,   90,   89,   88,   87,   86,   85,
!        84,   83,   82,   81,   80,   79,   78,   77,   76,   73,
! 
!        72,   71,   70,   69,   68,   67,   66,   65,   64,   63,
!        62,   61,   60,   59,   58,   57,   32,   31,   55,   52,
!        45,   40,   39,   38,   37,   33,   32,   32,   31,  106,
!        28,   28,    5,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106
      } ;
  
! static yyconst short int yy_chk[175] =
      {   0,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
--- 357,426 ----
  static yyconst int yy_meta[42] =
      {   0,
+         1,    2,    2,    1,    1,    1,    1,    1,    1,    1,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
!         3
      } ;
  
! static yyconst short int yy_base[118] =
      {   0,
!         0,    0,  103,  102,   40,   42,  142,  145,   44,   46,
!       138,  134,  133,  105,   25,  102,  106,   99,  110,   28,
!        28,  102,   40,   21,  111,   38,  110,  145,    0,  145,
!         0,  145,  145,   63,  127,  145,  123,   95,   94,   96,
!        94,   93,  100,   92,   91,  145,   98,   89,   87,   94,
!       108,   86,   75,   78,   78,   39,   89,   71,   77,   75,
!         0,    0,   76,   84,   82,   71,   70,  145,   80,   78,
!       145,   73,   67,   62,  145,   73,   61,   71,  145,   57,
!        67,   67,   42,   52,   41,   36,   45,  145,  145,  145,
!       145,   48,  145,  145,   41,  145,  145,  145,  145,  145,
  
!       145,  145,  145,  145,  145,   44,   34,   31,  145,  145,
!       145,  145,   78,   81,   84,   87,   89
      } ;
  
! static yyconst short int yy_def[118] =
      {   0,
!       112,    1,  113,  113,  114,  114,  112,  112,  112,  112,
!       115,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  116,  112,
!       117,  112,  112,  112,  115,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       116,  117,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
  
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,    0,  112,  112,  112,  112,  112
      } ;
  
! static yyconst short int yy_nxt[187] =
      {   0,
!         8,    9,   10,   11,   12,   13,   14,   15,   16,   17,
!        18,   19,   20,   21,   22,   23,   24,   25,   26,   27,
!         8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
!         8,    8,    8,    8,    8,    8,    8,    8,    8,    8,
!        28,   32,   33,   32,   33,   34,   34,   34,   34,   39,
!        46,   55,   48,   56,  111,   40,   51,   47,   49,   41,
!        52,   58,   80,   53,   34,   34,  110,  109,  108,   81,
!        54,  107,  106,  105,  104,  103,  102,   59,   29,   29,
!        29,   31,   31,   31,   35,   35,   35,   61,   61,   62,
!       101,   62,  100,   99,   98,   97,   96,   95,   94,   93,
! 
!        92,   91,   90,   89,   88,   87,   86,   85,   84,   83,
!        82,   79,   78,   77,   76,   75,   74,   73,   72,   71,
!        70,   69,   68,   67,   66,   65,   64,   63,   37,   36,
!        60,   57,   50,   45,   44,   43,   42,   38,   37,   37,
!        36,  112,   30,   30,    7,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112
      } ;
  
! static yyconst short int yy_chk[187] =
      {   0,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
***************
*** 424,442 ****
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
!         1,    7,    7,    8,    8,   13,   18,   22,   19,   22,
!       109,   13,   21,   18,   19,   13,   21,   24,   51,   21,
!        29,   29,  102,  101,  100,   51,   21,   89,   86,   81,
!        80,   79,   78,   24,  107,  107,  108,  108,   77,   76,
!        75,   74,   72,   71,   70,   68,   67,   66,   64,   63,
!        61,   60,   59,   58,   57,   55,   54,   53,   52,   50,
! 
!        49,   48,   47,   46,   45,   44,   43,   42,   40,   39,
!        38,   37,   36,   35,   34,   33,   32,   30,   25,   23,
!        20,   17,   16,   15,   14,   12,   11,   10,    9,    5,
!         4,    3,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106,  106,  106,  106,  106,  106,  106,
!       106,  106,  106,  106
      } ;
  
--- 428,447 ----
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
          1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
!         1,    5,    5,    6,    6,    9,    9,   10,   10,   15,
!        20,   24,   21,   24,  108,   15,   23,   20,   21,   15,
!        23,   26,   56,   23,   34,   34,  107,  106,   95,   56,
!        23,   92,   87,   86,   85,   84,   83,   26,  113,  113,
!       113,  114,  114,  114,  115,  115,  115,  116,  116,  117,
!        82,  117,   81,   80,   78,   77,   76,   74,   73,   72,
! 
!        70,   69,   67,   66,   65,   64,   63,   60,   59,   58,
!        57,   55,   54,   53,   52,   51,   50,   49,   48,   47,
!        45,   44,   43,   42,   41,   40,   39,   38,   37,   35,
!        27,   25,   22,   19,   18,   17,   16,   14,   13,   12,
!        11,    7,    4,    3,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112,  112,  112,  112,  112,
!       112,  112,  112,  112,  112,  112
      } ;
  
***************
*** 474,482 ****
  
  #define YY_DECL int parse_dlgfile (std::string &mytext, int &mynum)
  #define text 1
  
  #define YY_NO_UNPUT 1
  #define YY_NEVER_INTERACTIVE 1
! #line 481 "lex.loadlg.cc"
  
  /* Macros after this point can all be overridden by user definitions in
--- 479,492 ----
  
  #define YY_DECL int parse_dlgfile (std::string &mytext, int &mynum)
+ 
+ #define MAX_INCLUDE_DEPTH 10
+ YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+ int include_stack_ptr = 0;
  #define text 1
+ #define module 2
  
  #define YY_NO_UNPUT 1
  #define YY_NEVER_INTERACTIVE 1
! #line 491 "lex.loadlg.cc"
  
  /* Macros after this point can all be overridden by user definitions in
***************
*** 629,636 ****
        register int yy_act;
  
! #line 29 "loadlg.l"
  
  
! #line 635 "lex.loadlg.cc"
  
        if ( yy_init )
--- 639,646 ----
        register int yy_act;
  
! #line 33 "loadlg.l"
  
  
! #line 645 "lex.loadlg.cc"
  
        if ( yy_init )
***************
*** 683,687 ****
                                {
                                yy_current_state = (int) 
yy_def[yy_current_state];
!                               if ( yy_current_state >= 107 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
--- 693,697 ----
                                {
                                yy_current_state = (int) 
yy_def[yy_current_state];
!                               if ( yy_current_state >= 113 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
***************
*** 689,693 ****
                        ++yy_cp;
                        }
!               while ( yy_base[yy_current_state] != 133 );
  
  yy_find_action:
--- 699,703 ----
                        ++yy_cp;
                        }
!               while ( yy_base[yy_current_state] != 145 );
  
  yy_find_action:
***************
*** 717,882 ****
  case 1:
  YY_RULE_SETUP
! #line 31 "loadlg.l"
  ;    /* Eat up comments */
        YY_BREAK
  case 2:
  YY_RULE_SETUP
! #line 33 "loadlg.l"
  return LOAD_CIRCLE;
        YY_BREAK
  case 3:
  YY_RULE_SETUP
! #line 34 "loadlg.l"
  return LOAD_ARROW;
        YY_BREAK
  case 4:
  YY_RULE_SETUP
! #line 35 "loadlg.l"
! return LOAD_MODULE;
        YY_BREAK
  case 5:
  YY_RULE_SETUP
! #line 36 "loadlg.l"
! return LOAD_END;
        YY_BREAK
  case 6:
  YY_RULE_SETUP
! #line 37 "loadlg.l"
! return LOAD_TYPE;
        YY_BREAK
  case 7:
  YY_RULE_SETUP
! #line 38 "loadlg.l"
! return LOAD_PREV;
        YY_BREAK
  case 8:
  YY_RULE_SETUP
! #line 39 "loadlg.l"
! return LOAD_NEXT;
        YY_BREAK
  case 9:
  YY_RULE_SETUP
! #line 40 "loadlg.l"
! return LOAD_LINK;
        YY_BREAK
  case 10:
  YY_RULE_SETUP
! #line 41 "loadlg.l"
! return LOAD_POS;
        YY_BREAK
  case 11:
  YY_RULE_SETUP
! #line 42 "loadlg.l"
! return LOAD_NOTE;
        YY_BREAK
  case 12:
  YY_RULE_SETUP
! #line 43 "loadlg.l"
! return LOAD_TEXT;
        YY_BREAK
  case 13:
  YY_RULE_SETUP
! #line 44 "loadlg.l"
! return LOAD_COND;
        YY_BREAK
  case 14:
  YY_RULE_SETUP
! #line 45 "loadlg.l"
! return LOAD_VARS;
        YY_BREAK
  case 15:
  YY_RULE_SETUP
! #line 46 "loadlg.l"
! return LOAD_FUNC;
        YY_BREAK
  case 16:
  YY_RULE_SETUP
! #line 47 "loadlg.l"
! return LOAD_NPC;
        YY_BREAK
  case 17:
  YY_RULE_SETUP
! #line 48 "loadlg.l"
! return LOAD_NAME;
        YY_BREAK
  case 18:
  YY_RULE_SETUP
! #line 49 "loadlg.l"
! return LOAD_RACE;
        YY_BREAK
  case 19:
  YY_RULE_SETUP
! #line 50 "loadlg.l"
! return LOAD_GENDER;
        YY_BREAK
  case 20:
  YY_RULE_SETUP
! #line 51 "loadlg.l"
! return LOAD_LOOP;
        YY_BREAK
  case 21:
  YY_RULE_SETUP
! #line 52 "loadlg.l"
! return LOAD_PROJECT;
        YY_BREAK
  case 22:
  YY_RULE_SETUP
! #line 53 "loadlg.l"
! return LOAD_IMPORTS;
        YY_BREAK
  case 23:
  YY_RULE_SETUP
! #line 54 "loadlg.l"
! return LOAD_DTOR;
        YY_BREAK
  case 24:
  YY_RULE_SETUP
! #line 55 "loadlg.l"
! return LOAD_CTOR;
        YY_BREAK
  case 25:
  YY_RULE_SETUP
! #line 56 "loadlg.l"
! return LOAD_ID;
        YY_BREAK
  case 26:
  YY_RULE_SETUP
! #line 58 "loadlg.l"
! mytext = ""; BEGIN(text);
        YY_BREAK
  case 27:
  YY_RULE_SETUP
! #line 59 "loadlg.l"
! BEGIN(INITIAL); return LOAD_STR;
        YY_BREAK
  case 28:
  YY_RULE_SETUP
! #line 60 "loadlg.l"
! mytext += yytext;
        YY_BREAK
  case 29:
  YY_RULE_SETUP
! #line 62 "loadlg.l"
! mynum = atoi (yytext); return LOAD_NUM;
        YY_BREAK
  case 30:
  YY_RULE_SETUP
! #line 64 "loadlg.l"
! ;
        YY_BREAK
  case 31:
  YY_RULE_SETUP
! #line 65 "loadlg.l"
! return LOAD_UNKNOWN;
        YY_BREAK
  case 32:
  YY_RULE_SETUP
! #line 66 "loadlg.l"
  ECHO;
        YY_BREAK
! #line 878 "lex.loadlg.cc"
! case YY_STATE_EOF(INITIAL):
! case YY_STATE_EOF(text):
!       yyterminate();
  
        case YY_END_OF_BUFFER:
--- 727,931 ----
  case 1:
  YY_RULE_SETUP
! #line 35 "loadlg.l"
  ;    /* Eat up comments */
        YY_BREAK
  case 2:
  YY_RULE_SETUP
! #line 37 "loadlg.l"
  return LOAD_CIRCLE;
        YY_BREAK
  case 3:
  YY_RULE_SETUP
! #line 38 "loadlg.l"
  return LOAD_ARROW;
        YY_BREAK
  case 4:
  YY_RULE_SETUP
! #line 39 "loadlg.l"
! return LOAD_END;
        YY_BREAK
  case 5:
  YY_RULE_SETUP
! #line 40 "loadlg.l"
! return LOAD_TYPE;
        YY_BREAK
  case 6:
  YY_RULE_SETUP
! #line 41 "loadlg.l"
! return LOAD_PREV;
        YY_BREAK
  case 7:
  YY_RULE_SETUP
! #line 42 "loadlg.l"
! return LOAD_NEXT;
        YY_BREAK
  case 8:
  YY_RULE_SETUP
! #line 43 "loadlg.l"
! return LOAD_LINK;
        YY_BREAK
  case 9:
  YY_RULE_SETUP
! #line 44 "loadlg.l"
! return LOAD_POS;
        YY_BREAK
  case 10:
  YY_RULE_SETUP
! #line 45 "loadlg.l"
! return LOAD_NOTE;
        YY_BREAK
  case 11:
  YY_RULE_SETUP
! #line 46 "loadlg.l"
! return LOAD_TEXT;
        YY_BREAK
  case 12:
  YY_RULE_SETUP
! #line 47 "loadlg.l"
! return LOAD_COND;
        YY_BREAK
  case 13:
  YY_RULE_SETUP
! #line 48 "loadlg.l"
! return LOAD_VARS;
        YY_BREAK
  case 14:
  YY_RULE_SETUP
! #line 49 "loadlg.l"
! return LOAD_FUNC;
        YY_BREAK
  case 15:
  YY_RULE_SETUP
! #line 50 "loadlg.l"
! return LOAD_NPC;
        YY_BREAK
  case 16:
  YY_RULE_SETUP
! #line 51 "loadlg.l"
! return LOAD_NAME;
        YY_BREAK
  case 17:
  YY_RULE_SETUP
! #line 52 "loadlg.l"
! return LOAD_RACE;
        YY_BREAK
  case 18:
  YY_RULE_SETUP
! #line 53 "loadlg.l"
! return LOAD_GENDER;
        YY_BREAK
  case 19:
  YY_RULE_SETUP
! #line 54 "loadlg.l"
! return LOAD_LOOP;
        YY_BREAK
  case 20:
  YY_RULE_SETUP
! #line 55 "loadlg.l"
! return LOAD_PROJECT;
        YY_BREAK
  case 21:
  YY_RULE_SETUP
! #line 56 "loadlg.l"
! return LOAD_IMPORTS;
        YY_BREAK
  case 22:
  YY_RULE_SETUP
! #line 57 "loadlg.l"
! return LOAD_DTOR;
        YY_BREAK
  case 23:
  YY_RULE_SETUP
! #line 58 "loadlg.l"
! return LOAD_CTOR;
        YY_BREAK
  case 24:
  YY_RULE_SETUP
! #line 59 "loadlg.l"
! return LOAD_ID;
        YY_BREAK
  case 25:
  YY_RULE_SETUP
! #line 61 "loadlg.l"
! mytext = ""; BEGIN(module); return LOAD_MODULE;
        YY_BREAK
  case 26:
  YY_RULE_SETUP
! #line 63 "loadlg.l"
! /* Eat whitespace */
        YY_BREAK
  case 27:
  YY_RULE_SETUP
! #line 64 "loadlg.l"
! {
!                 mytext += yytext;
!                 BEGIN(INITIAL);
! 
!                 if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
!                 {
!                     fprintf (stderr, "Modules nested too deeply\n");
!                     return LOAD_UNKNOWN;
!                 }
!                 
!                 include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
!                 
!                 yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
!                 return LOAD_STR;
!                 }
!       YY_BREAK
! case YY_STATE_EOF(INITIAL):
! case YY_STATE_EOF(text):
! case YY_STATE_EOF(module):
! #line 80 "loadlg.l"
! {
!                 if (--include_stack_ptr < 0)
!                 {
!                     include_stack_ptr = 0;
!                     yyterminate ();
!                 }
!                 else
!                 {
!                     yy_delete_buffer (YY_CURRENT_BUFFER);
!                     yy_switch_to_buffer (include_stack[include_stack_ptr]);
!                     return 0;
!                 }
!                 }
        YY_BREAK
  case 28:
  YY_RULE_SETUP
! #line 94 "loadlg.l"
! mytext = ""; BEGIN(text);
        YY_BREAK
  case 29:
  YY_RULE_SETUP
! #line 95 "loadlg.l"
! BEGIN(INITIAL); return LOAD_STR;
        YY_BREAK
  case 30:
  YY_RULE_SETUP
! #line 96 "loadlg.l"
! mytext += yytext;
        YY_BREAK
  case 31:
  YY_RULE_SETUP
! #line 98 "loadlg.l"
! mynum = atoi (yytext); return LOAD_NUM;
        YY_BREAK
  case 32:
  YY_RULE_SETUP
! #line 100 "loadlg.l"
! ;
!       YY_BREAK
! case 33:
! YY_RULE_SETUP
! #line 101 "loadlg.l"
! return LOAD_UNKNOWN;
!       YY_BREAK
! case 34:
! YY_RULE_SETUP
! #line 102 "loadlg.l"
  ECHO;
        YY_BREAK
! #line 930 "lex.loadlg.cc"
  
        case YY_END_OF_BUFFER:
***************
*** 1168,1172 ****
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
!                       if ( yy_current_state >= 107 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
--- 1217,1221 ----
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
!                       if ( yy_current_state >= 113 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
***************
*** 1203,1211 ****
                {
                yy_current_state = (int) yy_def[yy_current_state];
!               if ( yy_current_state >= 107 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) 
yy_c];
!       yy_is_jam = (yy_current_state == 106);
  
        return yy_is_jam ? 0 : yy_current_state;
--- 1252,1260 ----
                {
                yy_current_state = (int) yy_def[yy_current_state];
!               if ( yy_current_state >= 113 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) 
yy_c];
!       yy_is_jam = (yy_current_state == 112);
  
        return yy_is_jam ? 0 : yy_current_state;
***************
*** 1762,1764 ****
        }
  #endif
! #line 66 "loadlg.l"
--- 1811,1813 ----
        }
  #endif
! #line 102 "loadlg.l"

Index: loadlg.l
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/loadlg.l,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** loadlg.l    9 Nov 2002 21:47:02 -0000       1.13
--- loadlg.l    1 Jan 2003 19:26:10 -0000       1.14
***************
*** 19,22 ****
--- 19,26 ----
  
  #define YY_DECL int parse_dlgfile (std::string &mytext, int &mynum)
+ 
+ #define MAX_INCLUDE_DEPTH 10
+ YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
+ int include_stack_ptr = 0;
  %}
  
***************
*** 24,28 ****
  num    -?{digit}+
  
! %x text
  %option noyywrap nounput never-interactive prefix="loadlg"
  
--- 28,32 ----
  num    -?{digit}+
  
! %x text module
  %option noyywrap nounput never-interactive prefix="loadlg"
  
***************
*** 33,37 ****
  Circle          return LOAD_CIRCLE;
  Arrow           return LOAD_ARROW;
- Module          return LOAD_MODULE;
  End             return LOAD_END;
  Type            return LOAD_TYPE;
--- 37,40 ----
***************
*** 56,59 ****
--- 59,95 ----
  Id              return LOAD_ID;
  
+ Module          mytext = ""; BEGIN(module); return LOAD_MODULE;
+ 
+ <module>[ \t]   /* Eat whitespace */
+ <module>[^ \t\n]+ {
+                 mytext += yytext;
+                 BEGIN(INITIAL);
+ 
+                 if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
+                 {
+                     fprintf (stderr, "Modules nested too deeply\n");
+                     return LOAD_UNKNOWN;
+                 }
+                 
+                 include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
+                 
+                 yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
+                 return LOAD_STR;
+                 }
+ 
+ <<EOF>>         {
+                 if (--include_stack_ptr < 0)
+                 {
+                     include_stack_ptr = 0;
+                     yyterminate ();
+                 }
+                 else
+                 {
+                     yy_delete_buffer (YY_CURRENT_BUFFER);
+                     yy_switch_to_buffer (include_stack[include_stack_ptr]);
+                     return 0;
+                 }
+                 }
+              
  §               mytext = ""; BEGIN(text);
  <text>§         BEGIN(INITIAL); return LOAD_STR;




reply via email to

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