]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - include/iscriplib.h
basic architecture for game configuration at runtime. writes out a .game, no sanity...
[xonotic/netradiant.git] / include / iscriplib.h
1 /*
2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5 This file is part of GtkRadiant.
6
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.
11
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.
16
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
20 */
21
22 //-----------------------------------------------------------------------------
23 //
24 // DESCRIPTION:
25 // all purpose scriplib interface for Q3Radiant plugins (cf. parse.h)
26 //
27
28 #ifndef __ISCRIPLIB_H_
29 #define __ISCRIPLIB_H_
30
31 /*! \file 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
36  
37  NOTE: I hope we can totally get rid of this part when we have XML support
38 */
39
40 #define SCRIPLIB_MAJOR "scriptlib"
41
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 *);
47 // script line
48 typedef int       (* PFN_SCRIPTLINE) ();
49 typedef qboolean  (* PFN_TOKENAVAILABLE) ();
50 // COM_Parse
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);
55
56 struct _QERScripLibTable
57 {
58         float m_fVersion;
59         int m_nSize;
60         PFN_GETTOKEN    m_pfnGetToken;
61         PFN_GETTOKENEXTRA       m_pfnGetTokenExtra; // Hydra: added support for GetTokenExtra()
62         PFN_UNGETTOKEN  m_pfnUnGetToken;
63         PFN_TOKEN               m_pfnToken;
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;
69 };
70
71 #ifdef USE_SCRIPLIBTABLE_DEFINE
72 #ifndef __SCRIPLIBTABLENAME
73 #define __SCRIPLIBTABLENAME g_ScripLibTable
74 #endif
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()
84 #endif
85
86 #endif