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 dlg_arrow.cc,1.8,1.


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: adonthell/src/tools/dlgedit dlg_arrow.cc,1.8,1.9 dlg_circle.h,1.8,1.9 dlg_module.cc,1.14,1.15 dlg_node.h,1.6,1.7 gui_dlgedit.cc,1.13,1.14 lex.loadlg.cc,1.17,1.18 loadlg.l,1.14,1.15
Date: Wed, 01 Jan 2003 15:47:20 -0500

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

Modified Files:
        dlg_arrow.cc dlg_circle.h dlg_module.cc dlg_node.h 
        gui_dlgedit.cc lex.loadlg.cc loadlg.l 
Log Message:
FIXED crash when subdialogue cannot be loaded correctly


Index: dlg_arrow.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_arrow.cc,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** dlg_arrow.cc        1 Jan 2003 19:26:10 -0000       1.8
--- dlg_arrow.cc        1 Jan 2003 20:47:18 -0000       1.9
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2002/2003 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  

Index: dlg_circle.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_circle.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** dlg_circle.h        1 Jan 2003 19:26:10 -0000       1.8
--- dlg_circle.h        1 Jan 2003 20:47:18 -0000       1.9
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2002/2003 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  

Index: dlg_module.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_module.cc,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** dlg_module.cc       1 Jan 2003 19:26:10 -0000       1.14
--- dlg_module.cc       1 Jan 2003 20:47:18 -0000       1.15
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2002/2003 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 424,427 ****
--- 424,430 ----
          }
      }
+     
+     // set serial of version 1 dialogues
+     if (serial_ < id) serial_ = id;
      
      return true;

Index: dlg_node.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/dlg_node.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** dlg_node.h  9 Nov 2002 21:47:02 -0000       1.6
--- dlg_node.h  1 Jan 2003 20:47:18 -0000       1.7
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2002/2003 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 29,35 ****
  #include "dlg_node_gfx.h"
  
  
! // Definitions needed for the dialogue source file parser
! extern int parse_dlgfile (std::string&, int&);
  extern FILE *loadlgin;
  
--- 29,43 ----
  #include "dlg_node_gfx.h"
  
+ /*
+  * Function to read the next token from dialogue source file
+  * @param str used to return string values
+  * @param i used to return numeric values
+  * @return Type of token read as defined in dlg_types.h
+  */
+ extern int parse_dlgfile (std::string &str, int &i);
  
! /**
!  * File pointer for dialogue source files being parsed.
!  */
  extern FILE *loadlgin;
  

Index: gui_dlgedit.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/gui_dlgedit.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** gui_dlgedit.cc      1 Jan 2003 19:26:10 -0000       1.13
--- gui_dlgedit.cc      1 Jan 2003 20:47:18 -0000       1.14
***************
*** 2,6 ****
     $Id$
  
!    Copyright (C) 2002 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 2,6 ----
     $Id$
  
!    Copyright (C) 2002/2003 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 41,49 ****
  #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[] = {
  "16 16 13 1",
--- 41,60 ----
  #include "gui_dlgedit_events.h"
  
! /**
!  * Point parser to another file to load sub-dialogue.
!  * Defined in loadlg.l
!  */
! extern void parser_switch_input ();
! 
! /**
!  * Return to previous input file after loading sub-dialogue - or 
!  * after failing to do so.
!  * Defined in loadlg.l
!  */
! extern void parser_restore_input ();
! 
! /**
!  * Icon of the main window
!  */
  static char * icon_xpm[] = {
  "16 16 13 1",
***************
*** 78,85 ****
  "=*.   @=+..>    "};
  
! // Global pointer to the main window
  GuiDlgedit *GuiDlgedit::window = NULL;
  
! // Strings describing the various program states
  char *GuiDlgedit::progState[NUM_MODES] = 
      { " IDLE", " SELECTED", " HIGHLIGHTED", " DRAGGED", " PREVIEW" };
--- 89,100 ----
  "=*.   @=+..>    "};
  
! /**
!  * Global pointer to the main window
!  */
  GuiDlgedit *GuiDlgedit::window = NULL;
  
! /**
!  * Strings describing the various program states
!  */
  char *GuiDlgedit::progState[NUM_MODES] = 
      { " IDLE", " SELECTED", " HIGHLIGHTED", " DRAGGED", " PREVIEW" };
***************
*** 475,480 ****
      DlgModule *module = new DlgModule (directory_, filename, "", "");
  
!     // loading successful
!     // loadlg_switch_to_buffer (loadlg_create_buffer (loadlgin, 16384));
  
      // try to load from file
--- 490,495 ----
      DlgModule *module = new DlgModule (directory_, filename, "", "");
  
!     // parser needs to read from sub-dialogue source file
!     parser_switch_input ();
  
      // try to load from file
***************
*** 482,486 ****
      {
          delete module;
!         message->display (-3, filename.c_str ());
          return NULL;
      }
--- 497,501 ----
      {
          delete module;
!         parser_restore_input ();
          return NULL;
      }
***************
*** 787,804 ****
  {
      // first, open the file
!     loadlgin = fopen (file.c_str (), "rb");
  
!     if (!loadlgin)
          return false;
      
      // check if it's a regular file
      struct stat statbuf;
!     fstat (fileno (loadlgin), &statbuf);
      if (!S_ISREG (statbuf.st_mode))
      {
!         fclose (loadlgin);
          return false;
      }
      
      return true;
  }
--- 802,820 ----
  {
      // first, open the file
!     FILE *test = fopen (file.c_str (), "rb");
  
!     if (!test)
          return false;
      
      // check if it's a regular file
      struct stat statbuf;
!     fstat (fileno (test), &statbuf);
      if (!S_ISREG (statbuf.st_mode))
      {
!         fclose (test);
          return false;
      }
      
+     loadlgin = test;
      return true;
  }

Index: lex.loadlg.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/lex.loadlg.cc,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -r1.17 -r1.18
*** lex.loadlg.cc       1 Jan 2003 19:26:10 -0000       1.17
--- lex.loadlg.cc       1 Jan 2003 20:47:18 -0000       1.18
***************
*** 463,467 ****
     $Id$
  
!    Copyright (C) 2000 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 463,467 ----
     $Id$
  
!    Copyright (C) 2000/2002/2003 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 480,486 ****
--- 480,501 ----
  #define YY_DECL int parse_dlgfile (std::string &mytext, int &mynum)
  
+ // definitions for using 'includes'
  #define MAX_INCLUDE_DEPTH 10
  YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
  int include_stack_ptr = 0;
+ 
+ // switch to another file for input
+ void parser_switch_input ()
+ {
+     include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
+     yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
+ }
+ 
+ // return to previous file
+ void parser_restore_input ()
+ {
+     yy_delete_buffer (YY_CURRENT_BUFFER);
+     yy_switch_to_buffer (include_stack[include_stack_ptr]);
+ }
  #define text 1
  #define module 2
***************
*** 488,492 ****
  #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
--- 503,507 ----
  #define YY_NO_UNPUT 1
  #define YY_NEVER_INTERACTIVE 1
! #line 506 "lex.loadlg.cc"
  
  /* Macros after this point can all be overridden by user definitions in
***************
*** 639,646 ****
        register int yy_act;
  
! #line 33 "loadlg.l"
  
  
! #line 645 "lex.loadlg.cc"
  
        if ( yy_init )
--- 654,661 ----
        register int yy_act;
  
! #line 48 "loadlg.l"
  
  
! #line 660 "lex.loadlg.cc"
  
        if ( yy_init )
***************
*** 727,861 ****
  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;
--- 742,876 ----
  case 1:
  YY_RULE_SETUP
! #line 50 "loadlg.l"
  ;    /* Eat up comments */
        YY_BREAK
  case 2:
  YY_RULE_SETUP
! #line 52 "loadlg.l"
  return LOAD_CIRCLE;
        YY_BREAK
  case 3:
  YY_RULE_SETUP
! #line 53 "loadlg.l"
  return LOAD_ARROW;
        YY_BREAK
  case 4:
  YY_RULE_SETUP
! #line 54 "loadlg.l"
  return LOAD_END;
        YY_BREAK
  case 5:
  YY_RULE_SETUP
! #line 55 "loadlg.l"
  return LOAD_TYPE;
        YY_BREAK
  case 6:
  YY_RULE_SETUP
! #line 56 "loadlg.l"
  return LOAD_PREV;
        YY_BREAK
  case 7:
  YY_RULE_SETUP
! #line 57 "loadlg.l"
  return LOAD_NEXT;
        YY_BREAK
  case 8:
  YY_RULE_SETUP
! #line 58 "loadlg.l"
  return LOAD_LINK;
        YY_BREAK
  case 9:
  YY_RULE_SETUP
! #line 59 "loadlg.l"
  return LOAD_POS;
        YY_BREAK
  case 10:
  YY_RULE_SETUP
! #line 60 "loadlg.l"
  return LOAD_NOTE;
        YY_BREAK
  case 11:
  YY_RULE_SETUP
! #line 61 "loadlg.l"
  return LOAD_TEXT;
        YY_BREAK
  case 12:
  YY_RULE_SETUP
! #line 62 "loadlg.l"
  return LOAD_COND;
        YY_BREAK
  case 13:
  YY_RULE_SETUP
! #line 63 "loadlg.l"
  return LOAD_VARS;
        YY_BREAK
  case 14:
  YY_RULE_SETUP
! #line 64 "loadlg.l"
  return LOAD_FUNC;
        YY_BREAK
  case 15:
  YY_RULE_SETUP
! #line 65 "loadlg.l"
  return LOAD_NPC;
        YY_BREAK
  case 16:
  YY_RULE_SETUP
! #line 66 "loadlg.l"
  return LOAD_NAME;
        YY_BREAK
  case 17:
  YY_RULE_SETUP
! #line 67 "loadlg.l"
  return LOAD_RACE;
        YY_BREAK
  case 18:
  YY_RULE_SETUP
! #line 68 "loadlg.l"
  return LOAD_GENDER;
        YY_BREAK
  case 19:
  YY_RULE_SETUP
! #line 69 "loadlg.l"
  return LOAD_LOOP;
        YY_BREAK
  case 20:
  YY_RULE_SETUP
! #line 70 "loadlg.l"
  return LOAD_PROJECT;
        YY_BREAK
  case 21:
  YY_RULE_SETUP
! #line 71 "loadlg.l"
  return LOAD_IMPORTS;
        YY_BREAK
  case 22:
  YY_RULE_SETUP
! #line 72 "loadlg.l"
  return LOAD_DTOR;
        YY_BREAK
  case 23:
  YY_RULE_SETUP
! #line 73 "loadlg.l"
  return LOAD_CTOR;
        YY_BREAK
  case 24:
  YY_RULE_SETUP
! #line 74 "loadlg.l"
  return LOAD_ID;
        YY_BREAK
  case 25:
  YY_RULE_SETUP
! #line 76 "loadlg.l"
  mytext = ""; BEGIN(module); return LOAD_MODULE;
        YY_BREAK
  case 26:
  YY_RULE_SETUP
! #line 78 "loadlg.l"
  /* Eat whitespace */
        YY_BREAK
  case 27:
  YY_RULE_SETUP
! #line 79 "loadlg.l"
  {
                  mytext += yytext;
***************
*** 868,874 ****
                  }
                  
-                 include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
-                 
-                 yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
                  return LOAD_STR;
                  }
--- 883,886 ----
***************
*** 877,881 ****
  case YY_STATE_EOF(text):
  case YY_STATE_EOF(module):
! #line 80 "loadlg.l"
  {
                  if (--include_stack_ptr < 0)
--- 889,893 ----
  case YY_STATE_EOF(text):
  case YY_STATE_EOF(module):
! #line 92 "loadlg.l"
  {
                  if (--include_stack_ptr < 0)
***************
*** 886,891 ****
                  else
                  {
!                     yy_delete_buffer (YY_CURRENT_BUFFER);
!                     yy_switch_to_buffer (include_stack[include_stack_ptr]);
                      return 0;
                  }
--- 898,902 ----
                  else
                  {
!                     parser_restore_input ();
                      return 0;
                  }
***************
*** 894,931 ****
  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:
--- 905,942 ----
  case 28:
  YY_RULE_SETUP
! #line 105 "loadlg.l"
  mytext = ""; BEGIN(text);
        YY_BREAK
  case 29:
  YY_RULE_SETUP
! #line 106 "loadlg.l"
  BEGIN(INITIAL); return LOAD_STR;
        YY_BREAK
  case 30:
  YY_RULE_SETUP
! #line 107 "loadlg.l"
  mytext += yytext;
        YY_BREAK
  case 31:
  YY_RULE_SETUP
! #line 109 "loadlg.l"
  mynum = atoi (yytext); return LOAD_NUM;
        YY_BREAK
  case 32:
  YY_RULE_SETUP
! #line 111 "loadlg.l"
  ;
        YY_BREAK
  case 33:
  YY_RULE_SETUP
! #line 112 "loadlg.l"
  return LOAD_UNKNOWN;
        YY_BREAK
  case 34:
  YY_RULE_SETUP
! #line 113 "loadlg.l"
  ECHO;
        YY_BREAK
! #line 941 "lex.loadlg.cc"
  
        case YY_END_OF_BUFFER:
***************
*** 1811,1813 ****
        }
  #endif
! #line 102 "loadlg.l"
--- 1822,1824 ----
        }
  #endif
! #line 113 "loadlg.l"

Index: loadlg.l
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/tools/dlgedit/loadlg.l,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** loadlg.l    1 Jan 2003 19:26:10 -0000       1.14
--- loadlg.l    1 Jan 2003 20:47:18 -0000       1.15
***************
*** 3,7 ****
     $Id$
  
!    Copyright (C) 2000 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
--- 3,7 ----
     $Id$
  
!    Copyright (C) 2000/2002/2003 Kai Sterker <address@hidden>
     Part of the Adonthell Project http://adonthell.linuxgames.com
  
***************
*** 20,26 ****
--- 20,41 ----
  #define YY_DECL int parse_dlgfile (std::string &mytext, int &mynum)
  
+ // definitions for using 'includes'
  #define MAX_INCLUDE_DEPTH 10
  YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
  int include_stack_ptr = 0;
+ 
+ // switch to another file for input
+ void parser_switch_input ()
+ {
+     include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
+     yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
+ }
+ 
+ // return to previous file
+ void parser_restore_input ()
+ {
+     yy_delete_buffer (YY_CURRENT_BUFFER);
+     yy_switch_to_buffer (include_stack[include_stack_ptr]);
+ }
  %}
  
***************
*** 72,78 ****
                  }
                  
-                 include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
-                 
-                 yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
                  return LOAD_STR;
                  }
--- 87,90 ----
***************
*** 86,91 ****
                  else
                  {
!                     yy_delete_buffer (YY_CURRENT_BUFFER);
!                     yy_switch_to_buffer (include_stack[include_stack_ptr]);
                      return 0;
                  }
--- 98,102 ----
                  else
                  {
!                     parser_restore_input ();
                      return 0;
                  }




reply via email to

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