Moved parse into C++

Moved parse into C++

diff --git a/CMakeLists.txt b/CMakeLists.txt
index c6e23e8..ff0b801 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -260,7 +260,6 @@ set( QCOMMONLIST_HEADERS
 set( QCOMMONLIST_SOURCES
 	${MOUNT_DIR}/qcommon/common.cpp
 	${MOUNT_DIR}/qcommon/msg.cpp
-	${MOUNT_DIR}/qcommon/parse.cpp
 )
 
 set( FRAMEWORKS_HEADERS
@@ -273,6 +272,7 @@ set( FRAMEWORKS_HEADERS
 	${MOUNT_DIR}/API/MD5_api.h
 	${MOUNT_DIR}/API/Network_api.h
 	${MOUNT_DIR}/API/NetworkChain_api.h
+	${MOUNT_DIR}/API/Parse_api.h
 	${MOUNT_DIR}/framework/FileSystem.h
 	${MOUNT_DIR}/framework/CVarSystem.h
 	${MOUNT_DIR}/framework/CmdSystem.h
@@ -287,6 +287,7 @@ set( FRAMEWORKS_HEADERS
 	${MOUNT_DIR}/framework/SurfaceFlags_Tech3.h
 	${MOUNT_DIR}/framework/Network.h
 	${MOUNT_DIR}/framework/NetworkChain.h
+	${MOUNT_DIR}/framework/Parse.h
 )
 
 set( FRAMEWORKS_SOURCES
@@ -303,6 +304,7 @@ set( FRAMEWORKS_SOURCES
 	${MOUNT_DIR}/framework/Unzip.cpp
 	${MOUNT_DIR}/framework/Network.cpp
 	${MOUNT_DIR}/framework/NetworkChain.cpp
+	${MOUNT_DIR}/framework/Parse.cpp
 )
 
 set( CLIENTLIST_HEADERS
diff --git a/src/engine/API/Parse_api.h b/src/engine/API/Parse_api.h
new file mode 100644
index 0000000..2f50041
--- /dev/null
+++ b/src/engine/API/Parse_api.h
@@ -0,0 +1,55 @@
+////////////////////////////////////////////////////////////////////////////////////////
+// Copyright(C) 1999 - 2010 id Software LLC, a ZeniMax Media company.
+// Copyright(C) 2011 - 2020 Dusan Jocic <dusanjocic@msn.com>
+//
+// This file is part of the OpenWolf GPL Source Code.
+// OpenWolf Source Code 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 3 of the License, or
+// (at your option) any later version.
+//
+// OpenWolf Source Code 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.
+//
+// You should have received a copy of the GNU General Public License
+// along with OpenWolf Source Code. If not, see <http://www.gnu.org/licenses/>.
+//
+// In addition, the OpenWolf Source Code is also subject to certain additional terms.
+// You should have received a copy of these additional terms immediately following the
+// terms and conditions of the GNU General Public License which accompanied the
+// OpenWolf Source Code. If not, please request a copy in writing from id Software
+// at the address below.
+//
+// If you have questions concerning this license or the applicable additional terms,
+// you may contact in writing id Software LLC, c/o ZeniMax Media Inc.,
+// Suite 120, Rockville, Maryland 20850 USA.
+//
+// -------------------------------------------------------------------------------------
+// File name:   Parse_api.h
+// Created:
+// Compilers:   Microsoft Visual C++ 2019, gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
+// Description:
+// -------------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef __PARSE_API_H__
+#define __PARSE_API_H__
+
+//
+// idParseSystem
+//
+class idParseSystem
+{
+public:
+    virtual sint AddGlobalDefine( valueType* string ) = 0;
+    virtual sint LoadSourceHandle( pointer filename ) = 0;
+    virtual sint FreeSourceHandle( sint handle ) = 0;
+    virtual sint ReadTokenHandle( sint handle, pc_token_t* pc_token ) = 0;
+    virtual sint SourceFileAndLine( sint handle, valueType* filename, sint* line ) = 0;
+};
+
+extern idParseSystem* ParseSystem;
+
+#endif //!__MD4_API_H__
diff --git a/src/engine/API/cgame_api.h b/src/engine/API/cgame_api.h
index 6dda633..11d083e 100644
--- a/src/engine/API/cgame_api.h
+++ b/src/engine/API/cgame_api.h
@@ -64,12 +64,6 @@ struct cgameImports_t
     bool( *Key_IsDown )( sint keynum );
     sint( *Key_GetCatcher )( void );
     sint( *Key_GetKey )( pointer binding );
-    sint( *PC_AddGlobalDefine )( valueType* define );
-    sint( *PC_LoadSource )( pointer filename );
-    sint( *PC_FreeSource )( sint handle );
-    sint( *PC_ReadToken )( sint handle, pc_token_t* pc_token );
-    sint( *PC_SourceFileAndLine )( sint handle, valueType* filename, sint* line );
-    void ( *PC_UnreadLastToken )( sint handle );
     sint( *RealTime )( qtime_t* qtime );
     
     // this returns a handle.  arg0 is the name in the format "idlogo.roq", set arg1 to nullptr, alteredstates to false (do not alter gamestate)
@@ -115,6 +109,7 @@ struct cgameImports_t
 #ifndef DEDICATED
     idClientGUISystem* idGUISystem;
     idClientScreenSystem* clientScreenSystem;
+    idParseSystem* parseSystem;
 #endif
 };
 
diff --git a/src/engine/API/gui_api.h b/src/engine/API/gui_api.h
index 3fca3d5..deef93e 100644
--- a/src/engine/API/gui_api.h
+++ b/src/engine/API/gui_api.h
@@ -183,10 +183,6 @@ struct guiImports_t
     void( *Error )( sint level, pointer fmt, ... );
     void( *CheckAutoUpdate )( void );
     void( *GetAutoUpdate )( void );
-    sint( *Parse_LoadSourceHandle )( pointer filename );
-    sint( *Parse_FreeSourceHandle )( sint handle );
-    sint( *Parse_ReadTokenHandle )( sint handle, pc_token_t* pc_token );
-    sint( *Parse_SourceFileAndLine )( sint handle, valueType* filename, sint* line );
     
     void( *SetBinding )( sint keynum, pointer binding );
     void ( *GetBindingByString )( pointer binding, sint* key1, sint* key2 );
@@ -218,6 +214,7 @@ struct guiImports_t
     idClientLANSystem* idLANSystem;
     idClientGUISystem* idGUISystem;
     idClientScreenSystem* clientScreenSystem;
+    idParseSystem* parseSystem;
 #endif
 };
 
diff --git a/src/engine/API/sgame_api.h b/src/engine/API/sgame_api.h
index 612d87e..6bbc78c 100644
--- a/src/engine/API/sgame_api.h
+++ b/src/engine/API/sgame_api.h
@@ -67,10 +67,6 @@ struct gameImports_t
     void( *Error )( sint level, pointer fmt, ... );
     void( *Endgame )( void );
     sint( *RealTime )( qtime_t* qtime );
-    sint( *Parse_LoadSourceHandle )( pointer filename );
-    sint( *Parse_FreeSourceHandle )( sint handle );
-    sint( *Parse_ReadTokenHandle )( sint handle, pc_token_t* pc_token );
-    sint( *Parse_SourceFileAndLine )( sint handle, valueType* filename, sint* line );
     
     idSoundSystem* soundSystem;
     idCollisionModelManager* collisionModelManager;
@@ -85,6 +81,7 @@ struct gameImports_t
     idServerDemoSystem* serverDemoSystem;
     idSystem* idsystem;
     idServerCryptoSystem* serverCryptoSystem;
+    idParseSystem* parseSystem;
 };
 
 void trap_Print( pointer fmt );
diff --git a/src/engine/client/clientGUI.cpp b/src/engine/client/clientGUI.cpp
index e5c2be2..400695f 100644
--- a/src/engine/client/clientGUI.cpp
+++ b/src/engine/client/clientGUI.cpp
@@ -284,10 +284,6 @@ void idClientGUISystemLocal::CreateExportTable( void )
     exports.Print = Com_Printf;
     exports.Error = Com_Error;
     
-    exports.Parse_LoadSourceHandle = Parse_LoadSourceHandle;
-    exports.Parse_FreeSourceHandle = Parse_FreeSourceHandle;
-    exports.Parse_ReadTokenHandle = Parse_ReadTokenHandle;
-    exports.Parse_SourceFileAndLine = Parse_SourceFileAndLine;
     exports.RealTime = Com_RealTime;
     exports.CheckAutoUpdate = CL_CheckAutoUpdate;
     exports.GetAutoUpdate = CL_GetAutoUpdate;
@@ -298,7 +294,6 @@ void idClientGUISystemLocal::CreateExportTable( void )
     exports.SetOverstrikeMode = Key_SetOverstrikeMode;
     exports.ClearStates = Key_ClearStates;
     exports.Hunk_MemoryRemaining = Hunk_MemoryRemaining;
-    exports.RealTime = Com_RealTime;
     exports.PlayCinematic = CIN_PlayCinematic;
     exports.StopCinematic = CIN_StopCinematic;
     exports.RunCinematic = CIN_RunCinematic;
@@ -319,6 +314,7 @@ void idClientGUISystemLocal::CreateExportTable( void )
     exports.idLANSystem = clientLANSystem;
     exports.idGUISystem = clientGUISystem;
     exports.clientScreenSystem = clientScreenSystem;

[... diff too long, it was truncated ...]

GitHub
sha: 50aded0b