2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
7 GtkRadiant is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 GtkRadiant is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GtkRadiant; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 //-----------------------------------------------------------------------------
25 // all purpose scriplib interface for Q3Radiant plugins (cf. parse.h)
28 #ifndef __ISCRIPLIB_H_
29 #define __ISCRIPLIB_H_
32 \brief function tables for Radiant core's text parsing functions
33 two token based parsers cohexist in Radiant
34 the primary one (GetToken UnGetToken etc.) is used on the .map parsing etc.
35 COM_Parse is another parser, used on .def parse for instance
37 NOTE: I hope we can totally get rid of this part when we have XML support
40 #define SCRIPLIB_MAJOR "scriptlib"
42 typedef qboolean (* PFN_GETTOKEN) (qboolean crossline);
43 typedef void (* PFN_UNGETTOKEN) ();
44 // only used to retrieve &token
45 typedef char* (* PFN_TOKEN) ();
46 typedef void (* PFN_STARTTOKENPARSING) (char *);
48 typedef int (* PFN_SCRIPTLINE) ();
49 typedef qboolean (* PFN_TOKENAVAILABLE) ();
51 typedef char* (* PFN_COM_PARSE) (char *data);
52 typedef char* (* PFN_GET_COM_TOKEN) ();
53 // Hydra: added support for GetTokenExtra()
54 typedef qboolean (* PFN_GETTOKENEXTRA) (qboolean crossline,char *delimiters,qboolean keepdelimiter);
56 struct _QERScripLibTable
60 PFN_GETTOKEN m_pfnGetToken;
61 PFN_GETTOKENEXTRA m_pfnGetTokenExtra; // Hydra: added support for GetTokenExtra()
62 PFN_UNGETTOKEN m_pfnUnGetToken;
64 PFN_STARTTOKENPARSING m_pfnStartTokenParsing;
65 PFN_SCRIPTLINE m_pfnScriptLine;
66 PFN_TOKENAVAILABLE m_pfnTokenAvailable;
67 PFN_COM_PARSE m_pfnCOM_Parse;
68 PFN_GET_COM_TOKEN m_pfnGet_COM_Token;
71 #ifdef USE_SCRIPLIBTABLE_DEFINE
72 #ifndef __SCRIPLIBTABLENAME
73 #define __SCRIPLIBTABLENAME g_ScripLibTable
75 #define GetToken __SCRIPLIBTABLENAME.m_pfnGetToken
76 #define Token __SCRIPLIBTABLENAME.m_pfnToken
77 #define UnGetToken __SCRIPLIBTABLENAME.m_pfnUnGetToken
78 #define StartTokenParsing __SCRIPLIBTABLENAME.m_pfnStartTokenParsing
79 #define ScriptLine __SCRIPLIBTABLENAME.m_pfnScriptLine
80 #define TokenAvailable __SCRIPLIBTABLENAME.m_pfnTokenAvailable
81 #define COM_Parse __SCRIPLIBTABLENAME.m_pfnCOM_Parse
82 #define Get_COM_Token __SCRIPLIBTABLENAME.m_pfnGet_COM_Token
83 #define GetTokenExtra __SCRIPLIBTABLENAME.m_pfnGetTokenExtra // Hydra: added support for GetTokenExtra()