renamed COM_ParseTokenConsole to COM_ParseToken_Console
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 9 May 2007 11:00:14 +0000 (11:00 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 9 May 2007 11:00:14 +0000 (11:00 +0000)
split COM_ParseToken into COM_ParseToken_Simple, COM_ParseToken_QuakeC
and COM_ParseToken_VM_Tokenize which have different support for special
characters

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7256 d7cf8633-e32d-0410-b094-e92efae38249

15 files changed:
cl_parse.c
cl_particles.c
cmd.c
common.c
common.h
console.c
host_cmd.c
libcurl.c
menu.c
model_brush.c
model_shared.c
prvm_cmds.c
prvm_edict.c
r_shadow.c
sv_main.c

index 0542b58..3c93a37 100644 (file)
@@ -329,13 +329,13 @@ void CL_ParseEntityLump(char *entdata)
        data = entdata;
        if (!data)
                return;
-       if (!COM_ParseTokenConsole(&data))
+       if (!COM_ParseToken_Simple(&data, false))
                return; // error
        if (com_token[0] != '{')
                return; // error
        while (1)
        {
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        return; // error
                if (com_token[0] == '}')
                        break; // end of worldspawn
@@ -345,7 +345,7 @@ void CL_ParseEntityLump(char *entdata)
                        strlcpy (key, com_token, sizeof (key));
                while (key[strlen(key)-1] == ' ') // remove trailing spaces
                        key[strlen(key)-1] = 0;
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        return; // error
                strlcpy (value, com_token, sizeof (value));
                if (!strcmp("sky", key))
index 0162ab2..3d9523e 100644 (file)
@@ -209,7 +209,7 @@ void CL_Particles_ParseEffectInfo(const char *textstart, const char *textend)
                        argv[arrayindex][0] = 0;
                for (;;)
                {
-                       if (!COM_ParseToken(&text, true))
+                       if (!COM_ParseToken_Simple(&text, true))
                                return;
                        if (!strcmp(com_token, "\n"))
                                break;
diff --git a/cmd.c b/cmd.c
index 82a98ae..086f41e 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -566,7 +566,7 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma
                                cvar_t *cvar;
                                const char *tempin = in;
 
-                               COM_ParseTokenConsole( &tempin );
+                               COM_ParseToken_Console( &tempin );
                                // don't expand rcon_password or similar cvars (CVAR_PRIVATE flag)
                                if ((cvar = Cvar_FindVar(&com_token[0])) && !(cvar->flags & CVAR_PRIVATE)) {
                                        const char *cvarcontent = cvar->string;
@@ -776,7 +776,7 @@ static void Cmd_TokenizeString (const char *text)
                if (cmd_argc == 1)
                        cmd_args = text;
 
-               if (!COM_ParseTokenConsole(&text))
+               if (!COM_ParseToken_Console(&text))
                        return;
 
                if (cmd_argc < MAX_ARGS)
index fe7e442..cfeda89 100644 (file)
--- a/common.c
+++ b/common.c
@@ -665,12 +665,12 @@ void SZ_HexDumpToConsole(const sizebuf_t *buf)
 
 /*
 ==============
-COM_ParseToken
+COM_ParseToken_Simple
 
 Parse a token out of a string
 ==============
 */
-int COM_ParseToken(const char **datapointer, int returnnewline)
+int COM_ParseToken_Simple(const char **datapointer, int returnnewline)
 {
        int len;
        int c;
@@ -718,7 +718,10 @@ skipwhite:
                data++;
                while (*data && (data[0] != '*' || data[1] != '/'))
                        data++;
-               data += 2;
+               if (*data)
+                       data++;
+               if (*data)
+                       data++;
                goto skipwhite;
        }
        else if (*data == '\"')
@@ -735,23 +738,12 @@ skipwhite:
                        c = *data;
                        if (*data == '\\')
                        {
-                               if (data[1] == '"')
-                               {
-                                       data++;
-                                       c = *data;
-                               }
-                               else if (data[1] == '\'')
-                               {
-                                       data++;
-                                       c = *data;
-                               }
-                               else if (data[1] == 'n')
-                               {
-                                       data++;
+                               data++;
+                               c = *data;
+                               if (c == 'n')
                                        c = '\n';
-                               }
-                               else if (data[1] == '\\')
-                                       data++;
+                               else if (c == 't')
+                                       c = '\t';
                        }
                        com_token[len++] = c;
                }
@@ -759,10 +751,107 @@ skipwhite:
                *datapointer = data+1;
                return true;
        }
-       else if (*data == '\'')
+       else if (*data == '\r')
+       {
+               // translate Mac line ending to UNIX
+               com_token[len++] = '\n';data++;
+               com_token[len] = 0;
+               *datapointer = data;
+               return true;
+       }
+       else if (*data == '\n')
+       {
+               // single character
+               com_token[len++] = *data++;
+               com_token[len] = 0;
+               *datapointer = data;
+               return true;
+       }
+       else
+       {
+               // regular word
+               for (;*data > ' ';data++)
+               {
+                       if (len >= (int)sizeof(com_token) - 1)
+                       {
+                               com_token[0] = 0;
+                               *datapointer = NULL;
+                               return false;
+                       }
+                       com_token[len++] = *data;
+               }
+               com_token[len] = 0;
+               *datapointer = data;
+               return true;
+       }
+}
+
+/*
+==============
+COM_ParseToken_QuakeC
+
+Parse a token out of a string
+==============
+*/
+int COM_ParseToken_QuakeC(const char **datapointer, int returnnewline)
+{
+       int len;
+       int c;
+       const char *data = *datapointer;
+
+       len = 0;
+       com_token[0] = 0;
+
+       if (!data)
+       {
+               *datapointer = NULL;
+               return false;
+       }
+
+// skip whitespace
+skipwhite:
+       // line endings:
+       // UNIX: \n
+       // Mac: \r
+       // Windows: \r\n
+       for (;*data <= ' ' && ((*data != '\n' && *data != '\r') || !returnnewline);data++)
+       {
+               if (*data == 0)
+               {
+                       // end of file
+                       *datapointer = NULL;
+                       return false;
+               }
+       }
+
+       // handle Windows line ending
+       if (data[0] == '\r' && data[1] == '\n')
+               data++;
+
+       if (data[0] == '/' && data[1] == '/')
+       {
+               // comment
+               while (*data && *data != '\n' && *data != '\r')
+                       data++;
+               goto skipwhite;
+       }
+       else if (data[0] == '/' && data[1] == '*')
+       {
+               // comment
+               data++;
+               while (*data && (data[0] != '*' || data[1] != '/'))
+                       data++;
+               if (*data)
+                       data++;
+               if (*data)
+                       data++;
+               goto skipwhite;
+       }
+       else if (*data == '\"' || *data == '\'')
        {
                // quoted string
-               for (data++;*data != '\'';data++)
+               char quote = *data;
+               for (data++;*data != quote;data++)
                {
                        if (!*data || len >= (int)sizeof(com_token) - 1)
                        {
@@ -773,23 +862,12 @@ skipwhite:
                        c = *data;
                        if (*data == '\\')
                        {
-                               if (data[1] == '"')
-                               {
-                                       data++;
-                                       c = *data;
-                               }
-                               else if (data[1] == '\'')
-                               {
-                                       data++;
-                                       c = *data;
-                               }
-                               else if (data[1] == 'n')
-                               {
-                                       data++;
+                               data++;
+                               c = *data;
+                               if (c == 'n')
                                        c = '\n';
-                               }
-                               else if (data[1] == '\\')
-                                       data++;
+                               else if (c == 't')
+                                       c = '\t';
                        }
                        com_token[len++] = c;
                }
@@ -800,12 +878,12 @@ skipwhite:
        else if (*data == '\r')
        {
                // translate Mac line ending to UNIX
-               com_token[len++] = '\n';
+               com_token[len++] = '\n';data++;
                com_token[len] = 0;
                *datapointer = data;
                return true;
        }
-       else if (*data == '\n' || *data == '{' || *data == '}' || *data == ')' || *data == '(' || *data == ']' || *data == '[' || *data == '\'' || *data == ':' || *data == ',' || *data == ';')
+       else if (*data == '\n' || *data == '{' || *data == '}' || *data == ')' || *data == '(' || *data == ']' || *data == '[' || *data == ':' || *data == ',' || *data == ';')
        {
                // single character
                com_token[len++] = *data++;
@@ -816,7 +894,7 @@ skipwhite:
        else
        {
                // regular word
-               for (;*data > ' ' && *data != '{' && *data != '}' && *data != ')' && *data != '(' && *data != ']' && *data != '[' && *data != '\'' && *data != ':' && *data != ',' && *data != ';' && *data != '\'' && *data != '"';data++)
+               for (;*data > ' ' && *data != '{' && *data != '}' && *data != ')' && *data != '(' && *data != ']' && *data != '[' && *data != ':' && *data != ',' && *data != ';';data++)
                {
                        if (len >= (int)sizeof(com_token) - 1)
                        {
@@ -824,30 +902,133 @@ skipwhite:
                                *datapointer = NULL;
                                return false;
                        }
+                       com_token[len++] = *data;
+               }
+               com_token[len] = 0;
+               *datapointer = data;
+               return true;
+       }
+}
+
+/*
+==============
+COM_ParseToken_VM_Tokenize
+
+Parse a token out of a string
+==============
+*/
+int COM_ParseToken_VM_Tokenize(const char **datapointer, int returnnewline)
+{
+       int len;
+       int c;
+       const char *data = *datapointer;
+
+       len = 0;
+       com_token[0] = 0;
+
+       if (!data)
+       {
+               *datapointer = NULL;
+               return false;
+       }
+
+// skip whitespace
+skipwhite:
+       // line endings:
+       // UNIX: \n
+       // Mac: \r
+       // Windows: \r\n
+       for (;*data <= ' ' && ((*data != '\n' && *data != '\r') || !returnnewline);data++)
+       {
+               if (*data == 0)
+               {
+                       // end of file
+                       *datapointer = NULL;
+                       return false;
+               }
+       }
+
+       // handle Windows line ending
+       if (data[0] == '\r' && data[1] == '\n')
+               data++;
+
+       if (data[0] == '/' && data[1] == '/')
+       {
+               // comment
+               while (*data && *data != '\n' && *data != '\r')
+                       data++;
+               goto skipwhite;
+       }
+       else if (data[0] == '/' && data[1] == '*')
+       {
+               // comment
+               data++;
+               while (*data && (data[0] != '*' || data[1] != '/'))
+                       data++;
+               if (*data)
+                       data++;
+               if (*data)
+                       data++;
+               goto skipwhite;
+       }
+       else if (*data == '\"' || *data == '\'')
+       {
+               char quote = *data;
+               // quoted string
+               for (data++;*data != quote;data++)
+               {
+                       if (!*data || len >= (int)sizeof(com_token) - 1)
+                       {
+                               com_token[0] = 0;
+                               *datapointer = NULL;
+                               return false;
+                       }
                        c = *data;
                        if (*data == '\\')
                        {
-                               if (data[1] == '"')
-                               {
-                                       data++;
-                                       c = *data;
-                               }
-                               else if (data[1] == '\'')
-                               {
-                                       data++;
-                                       c = *data;
-                               }
-                               else if (data[1] == 'n')
-                               {
-                                       data++;
+                               data++;
+                               c = *data;
+                               if (c == 'n')
                                        c = '\n';
-                               }
-                               else if (data[1] == '\\')
-                                       data++;
+                               else if (c == 't')
+                                       c = '\t';
                        }
                        com_token[len++] = c;
                }
                com_token[len] = 0;
+               *datapointer = data+1;
+               return true;
+       }
+       else if (*data == '\r')
+       {
+               // translate Mac line ending to UNIX
+               com_token[len++] = '\n';data++;
+               com_token[len] = 0;
+               *datapointer = data;
+               return true;
+       }
+       else if (*data == '\n' || *data == ',' || *data == ';')
+       {
+               // single character
+               com_token[len++] = *data++;
+               com_token[len] = 0;
+               *datapointer = data;
+               return true;
+       }
+       else
+       {
+               // regular word
+               for (;*data > ' ' && *data != ',' && *data != ';';data++)
+               {
+                       if (len >= (int)sizeof(com_token) - 1)
+                       {
+                               com_token[0] = 0;
+                               *datapointer = NULL;
+                               return false;
+                       }
+                       com_token[len++] = *data;
+               }
+               com_token[len] = 0;
                *datapointer = data;
                return true;
        }
@@ -855,12 +1036,12 @@ skipwhite:
 
 /*
 ==============
-COM_ParseTokenConsole
+COM_ParseToken_Console
 
 Parse a token out of a string, behaving like the qwcl console
 ==============
 */
-int COM_ParseTokenConsole(const char **datapointer)
+int COM_ParseToken_Console(const char **datapointer)
 {
        int len;
        const char *data = *datapointer;
index 6bd42a2..47e62f9 100644 (file)
--- a/common.h
+++ b/common.h
@@ -202,8 +202,10 @@ float MSG_ReadAngle (protocolversion_t protocol);
 
 extern char com_token[MAX_INPUTLINE];
 
-int COM_ParseToken(const char **datapointer, int returnnewline);
-int COM_ParseTokenConsole(const char **datapointer);
+int COM_ParseToken_Simple(const char **datapointer, int returnnewline);
+int COM_ParseToken_QuakeC(const char **datapointer, int returnnewline);
+int COM_ParseToken_VM_Tokenize(const char **datapointer, int returnnewline);
+int COM_ParseToken_Console(const char **datapointer);
 
 extern int com_argc;
 extern const char **com_argv;
index 1c9f672..aeef3e6 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1178,7 +1178,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                for (;;)
                                {
                                        int l;
-                                       if (!COM_ParseTokenConsole(&data))
+                                       if (!COM_ParseToken_Simple(&data, false))
                                                break;
                                        if (com_token[0] == '{')
                                                continue;
@@ -1189,7 +1189,7 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer
                                        for (l = 0;l < (int)sizeof(keyname) - 1 && com_token[k+l] && com_token[k+l] > ' ';l++)
                                                keyname[l] = com_token[k+l];
                                        keyname[l] = 0;
-                                       if (!COM_ParseTokenConsole(&data))
+                                       if (!COM_ParseToken_Simple(&data, false))
                                                break;
                                        if (developer.integer >= 100)
                                                Con_Printf("key: %s %s\n", keyname, com_token);
index 20b0a9a..7875bff 100644 (file)
@@ -585,7 +585,7 @@ void Host_Loadgame_f (void)
        }
 
        // version
-       COM_ParseTokenConsole(&t);
+       COM_ParseToken_Simple(&t, false);
        version = atoi(com_token);
        if (version != SAVEGAME_VERSION)
        {
@@ -595,27 +595,25 @@ void Host_Loadgame_f (void)
        }
 
        // description
-       // this is a little hard to parse, as : is a separator in COM_ParseToken,
-       // so use the console parser instead
-       COM_ParseTokenConsole(&t);
+       COM_ParseToken_Simple(&t, false);
 
        for (i = 0;i < NUM_SPAWN_PARMS;i++)
        {
-               COM_ParseTokenConsole(&t);
+               COM_ParseToken_Simple(&t, false);
                spawn_parms[i] = atof(com_token);
        }
        // skill
-       COM_ParseTokenConsole(&t);
+       COM_ParseToken_Simple(&t, false);
 // this silliness is so we can load 1.06 save files, which have float skill values
        current_skill = (int)(atof(com_token) + 0.5);
        Cvar_SetValue ("skill", (float)current_skill);
 
        // mapname
-       COM_ParseTokenConsole(&t);
+       COM_ParseToken_Simple(&t, false);
        strlcpy (mapname, com_token, sizeof(mapname));
 
        // time
-       COM_ParseTokenConsole(&t);
+       COM_ParseToken_Simple(&t, false);
        time = atof(com_token);
 
        allowcheats = sv_cheats.integer != 0;
@@ -636,7 +634,7 @@ void Host_Loadgame_f (void)
        {
                // light style
                oldt = t;
-               COM_ParseTokenConsole(&t);
+               COM_ParseToken_Simple(&t, false);
                // if this is a 64 lightstyle savegame produced by Quake, stop now
                // we have to check this because darkplaces saves 256 lightstyle savegames
                if (com_token[0] == '{')
@@ -654,7 +652,7 @@ void Host_Loadgame_f (void)
        for(;;)
        {
                oldt = t;
-               COM_ParseTokenConsole(&t);
+               COM_ParseToken_Simple(&t, false);
                if (com_token[0] == '{')
                {
                        t = oldt;
@@ -669,10 +667,10 @@ void Host_Loadgame_f (void)
        for (;;)
        {
                start = t;
-               while (COM_ParseTokenConsole(&t))
+               while (COM_ParseToken_Simple(&t, false))
                        if (!strcmp(com_token, "}"))
                                break;
-               if (!COM_ParseTokenConsole(&start))
+               if (!COM_ParseToken_Simple(&start, false))
                {
                        // end of file
                        break;
@@ -1576,7 +1574,7 @@ void Host_Kick_f (void)
                if (Cmd_Argc() > 2)
                {
                        message = Cmd_Args();
-                       COM_ParseTokenConsole(&message);
+                       COM_ParseToken_Simple(&message, false);
                        if (byNumber)
                        {
                                message++;                                                      // skip the #
index 1c30808..afbab1a 100644 (file)
--- a/libcurl.c
+++ b/libcurl.c
@@ -1272,7 +1272,7 @@ void Curl_ClearRequirements()
        }
        p = sv_curl_serverpackages.string;
        Con_DPrintf("Require all of: %s\n", p);
-       while(COM_ParseTokenConsole(&p))
+       while(COM_ParseToken_Simple(&p, false))
        {
                Con_DPrintf("Require: %s\n", com_token);
                Curl_RequireFile(com_token);
diff --git a/menu.c b/menu.c
index 86e9a17..56004fa 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -893,10 +893,10 @@ static void M_ScanSaves (void)
                buf[sizeof(buf) - 1] = 0;
                t = buf;
                // version
-               COM_ParseTokenConsole(&t);
+               COM_ParseToken_Simple(&t, false);
                version = atoi(com_token);
                // description
-               COM_ParseTokenConsole(&t);
+               COM_ParseToken_Simple(&t, false);
                strlcpy (m_filenames[i], com_token, sizeof (m_filenames[i]));
 
        // change _ back to space
index 966c7bc..ca78e3c 100644 (file)
@@ -1748,13 +1748,13 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data)
        int i, j, k;
        if (!data)
                return;
-       if (!COM_ParseTokenConsole(&data))
+       if (!COM_ParseToken_Simple(&data, false))
                return; // error
        if (com_token[0] != '{')
                return; // error
        while (1)
        {
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        return; // error
                if (com_token[0] == '}')
                        break; // end of worldspawn
@@ -1764,7 +1764,7 @@ static void Mod_Q1BSP_ParseWadsFromEntityLump(const char *data)
                        strlcpy(key, com_token, sizeof(key));
                while (key[strlen(key)-1] == ' ') // remove trailing spaces
                        key[strlen(key)-1] = 0;
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        return; // error
                dpsnprintf(value, sizeof(value), "%s", com_token);
                if (!strcmp("wad", key)) // for HalfLife maps
@@ -2660,12 +2660,12 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
        if (!maptext)
                return;
        text = maptext;
-       if (!COM_ParseTokenConsole(&data))
+       if (!COM_ParseToken_Simple(&data, false))
                return; // error
        submodel = 0;
        for (;;)
        {
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        break;
                if (com_token[0] != '{')
                        return; // error
@@ -2676,7 +2676,7 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                brushes = Mem_Alloc(loadmodel->mempool, maxbrushes * sizeof(mbrush_t));
                for (;;)
                {
-                       if (!COM_ParseTokenConsole(&data))
+                       if (!COM_ParseToken_Simple(&data, false))
                                return; // error
                        if (com_token[0] == '}')
                                break; // end of entity
@@ -2700,7 +2700,7 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                                }
                                for (;;)
                                {
-                                       if (!COM_ParseTokenConsole(&data))
+                                       if (!COM_ParseToken_Simple(&data, false))
                                                return; // error
                                        if (com_token[0] == '}')
                                                break; // end of brush
@@ -2709,25 +2709,25 @@ static void Mod_Q1BSP_LoadMapBrushes(void)
                                        // FIXME: support hl .map format
                                        for (pointnum = 0;pointnum < 3;pointnum++)
                                        {
-                                               COM_ParseTokenConsole(&data);
+                                               COM_ParseToken_Simple(&data, false);
                                                for (componentnum = 0;componentnum < 3;componentnum++)
                                                {
-                                                       COM_ParseTokenConsole(&data);
+                                                       COM_ParseToken_Simple(&data, false);
                                                        point[pointnum][componentnum] = atof(com_token);
                                                }
-                                               COM_ParseTokenConsole(&data);
+                                               COM_ParseToken_Simple(&data, false);
                                        }
-                                       COM_ParseTokenConsole(&data);
+                                       COM_ParseToken_Simple(&data, false);
                                        strlcpy(facetexture, com_token, sizeof(facetexture));
-                                       COM_ParseTokenConsole(&data);
+                                       COM_ParseToken_Simple(&data, false);
                                        //scroll_s = atof(com_token);
-                                       COM_ParseTokenConsole(&data);
+                                       COM_ParseToken_Simple(&data, false);
                                        //scroll_t = atof(com_token);
-                                       COM_ParseTokenConsole(&data);
+                                       COM_ParseToken_Simple(&data, false);
                                        //rotate = atof(com_token);
-                                       COM_ParseTokenConsole(&data);
+                                       COM_ParseToken_Simple(&data, false);
                                        //scale_s = atof(com_token);
-                                       COM_ParseTokenConsole(&data);
+                                       COM_ParseToken_Simple(&data, false);
                                        //scale_t = atof(com_token);
                                        TriangleNormal(point[0], point[1], point[2], planenormal);
                                        VectorNormalizeDouble(planenormal);
@@ -4070,11 +4070,11 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l)
        memcpy(loadmodel->brush.entities, mod_base + l->fileofs, l->filelen);
        data = loadmodel->brush.entities;
        // some Q3 maps override the lightgrid_cellsize with a worldspawn key
-       if (data && COM_ParseTokenConsole(&data) && com_token[0] == '{')
+       if (data && COM_ParseToken_Simple(&data, false) && com_token[0] == '{')
        {
                while (1)
                {
-                       if (!COM_ParseTokenConsole(&data))
+                       if (!COM_ParseToken_Simple(&data, false))
                                break; // error
                        if (com_token[0] == '}')
                                break; // end of worldspawn
@@ -4084,7 +4084,7 @@ static void Mod_Q3BSP_LoadEntities(lump_t *l)
                                strlcpy(key, com_token, sizeof(key));
                        while (key[strlen(key)-1] == ' ') // remove trailing spaces
                                key[strlen(key)-1] = 0;
-                       if (!COM_ParseTokenConsole(&data))
+                       if (!COM_ParseToken_Simple(&data, false))
                                break; // error
                        strlcpy(value, com_token, sizeof(value));
                        if (!strcmp("gridsize", key))
@@ -4151,7 +4151,7 @@ static void Mod_Q3BSP_LoadShaders(void)
                text = f = (char *)FS_LoadFile(search->filenames[fileindex], tempmempool, false, NULL);
                if (!f)
                        continue;
-               while (COM_ParseToken(&text, false))
+               while (COM_ParseToken_QuakeC(&text, false))
                {
                        if (q3shaders_numshaders >= Q3SHADER_MAXSHADERS)
                        {
@@ -4161,12 +4161,12 @@ static void Mod_Q3BSP_LoadShaders(void)
                        shader = q3shaders_shaders + q3shaders_numshaders++;
                        memset(shader, 0, sizeof(*shader));
                        strlcpy(shader->name, com_token, sizeof(shader->name));
-                       if (!COM_ParseToken(&text, false) || strcasecmp(com_token, "{"))
+                       if (!COM_ParseToken_QuakeC(&text, false) || strcasecmp(com_token, "{"))
                        {
                                Con_Printf("%s parsing error - expected \"{\", found \"%s\"\n", search->filenames[fileindex], com_token);
                                break;
                        }
-                       while (COM_ParseToken(&text, false))
+                       while (COM_ParseToken_QuakeC(&text, false))
                        {
                                if (!strcasecmp(com_token, "}"))
                                        break;
@@ -4182,7 +4182,7 @@ static void Mod_Q3BSP_LoadShaders(void)
                                        }
                                        else
                                                layer = NULL;
-                                       while (COM_ParseToken(&text, false))
+                                       while (COM_ParseToken_QuakeC(&text, false))
                                        {
                                                if (!strcasecmp(com_token, "}"))
                                                        break;
@@ -4198,7 +4198,7 @@ static void Mod_Q3BSP_LoadShaders(void)
                                                                strlcpy(parameter[j], com_token, sizeof(parameter[j]));
                                                                numparameters = j + 1;
                                                        }
-                                                       if (!COM_ParseToken(&text, true))
+                                                       if (!COM_ParseToken_QuakeC(&text, true))
                                                                break;
                                                }
                                                if (developer.integer >= 100)
@@ -4311,7 +4311,7 @@ static void Mod_Q3BSP_LoadShaders(void)
                                                strlcpy(parameter[j], com_token, sizeof(parameter[j]));
                                                numparameters = j + 1;
                                        }
-                                       if (!COM_ParseToken(&text, true))
+                                       if (!COM_ParseToken_QuakeC(&text, true))
                                                break;
                                }
                                if (fileindex == 0 && !strcasecmp(com_token, "}"))
index 058396c..1879f19 100644 (file)
@@ -1133,7 +1133,7 @@ tag_torso,
                for(line = 0;;line++)
                {
                        // parse line
-                       if (!COM_ParseToken(&data, true))
+                       if (!COM_ParseToken_QuakeC(&data, true))
                                break;
                        if (!strcmp(com_token, "\n"))
                                continue;
@@ -1146,7 +1146,7 @@ tag_torso,
                                else
                                        wordsoverflow = true;
                        }
-                       while (COM_ParseToken(&data, true) && strcmp(com_token, "\n"));
+                       while (COM_ParseToken_QuakeC(&data, true) && strcmp(com_token, "\n"));
                        if (wordsoverflow)
                        {
                                Con_Printf("Mod_LoadSkinFiles: parsing error in file \"%s_%i.skin\" on line #%i: line with too many statements, skipping\n", loadmodel->name, i, line);
index 1d1a73b..936b4d8 100644 (file)
@@ -1980,7 +1980,7 @@ void VM_tokenize (void)
        p = PRVM_G_STRING(OFS_PARM0);
 
        num_tokens = 0;
-       while(COM_ParseToken(&p, false))
+       while(COM_ParseToken_VM_Tokenize(&p, false))
        {
                if (num_tokens >= (int)(sizeof(tokens)/sizeof(tokens[0])))
                        break;
@@ -2206,15 +2206,15 @@ void VM_parseentitydata(void)
 
        VM_SAFEPARMCOUNT(2, VM_parseentitydata);
 
-    // get edict and test it
+       // get edict and test it
        ent = PRVM_G_EDICT(OFS_PARM0);
        if (ent->priv.required->free)
                PRVM_ERROR ("VM_parseentitydata: %s: Can only set already spawned entities (entity %i is free)!", PRVM_NAME, PRVM_NUM_FOR_EDICT(ent));
 
        data = PRVM_G_STRING(OFS_PARM1);
 
-    // parse the opening brace
-       if (!COM_ParseTokenConsole(&data) || com_token[0] != '{' )
+       // parse the opening brace
+       if (!COM_ParseToken_Simple(&data, false) || com_token[0] != '{' )
                PRVM_ERROR ("VM_parseentitydata: %s: Couldn't parse entity data:\n%s", PRVM_NAME, data );
 
        PRVM_ED_ParseEdict (data, ent);
index a9ed755..4b59235 100644 (file)
@@ -853,7 +853,7 @@ void PRVM_ED_ParseGlobals (const char *data)
        while (1)
        {
                // parse key
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        PRVM_ERROR ("PRVM_ED_ParseGlobals: EOF without closing brace");
                if (com_token[0] == '}')
                        break;
@@ -861,7 +861,7 @@ void PRVM_ED_ParseGlobals (const char *data)
                strlcpy (keyname, com_token, sizeof(keyname));
 
                // parse value
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        PRVM_ERROR ("PRVM_ED_ParseGlobals: EOF without closing brace");
 
                if (com_token[0] == '}')
@@ -1110,7 +1110,7 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
        while (1)
        {
        // parse key
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
                if (developer_entityparsing.integer)
                        Con_Printf("Key: \"%s\"", com_token);
@@ -1142,7 +1142,7 @@ const char *PRVM_ED_ParseEdict (const char *data, prvm_edict_t *ent)
                }
 
        // parse value
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        PRVM_ERROR ("PRVM_ED_ParseEdict: EOF without closing brace");
                if (developer_entityparsing.integer)
                        Con_Printf(" \"%s\"\n", com_token);
@@ -1217,7 +1217,7 @@ void PRVM_ED_LoadFromFile (const char *data)
        while (1)
        {
 // parse the opening brace
-               if (!COM_ParseTokenConsole(&data))
+               if (!COM_ParseToken_Simple(&data, false))
                        break;
                if (com_token[0] != '{')
                        PRVM_ERROR ("PRVM_ED_LoadFromFile: %s: found %s when expecting {", PRVM_NAME, com_token);
index 4a55c80..893a058 100644 (file)
@@ -3619,7 +3619,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                data = r_refdef.worldmodel->brush.entities;
        if (!data)
                return;
-       for (entnum = 0;COM_ParseTokenConsole(&data) && com_token[0] == '{';entnum++)
+       for (entnum = 0;COM_ParseToken_Simple(&data, false) && com_token[0] == '{';entnum++)
        {
                type = LIGHTTYPE_MINUSX;
                origin[0] = origin[1] = origin[2] = 0;
@@ -3637,7 +3637,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                islight = false;
                while (1)
                {
-                       if (!COM_ParseTokenConsole(&data))
+                       if (!COM_ParseToken_Simple(&data, false))
                                break; // error
                        if (com_token[0] == '}')
                                break; // end of entity
@@ -3647,7 +3647,7 @@ void R_Shadow_LoadWorldLightsFromMap_LightArghliteTyrlite(void)
                                strlcpy(key, com_token, sizeof(key));
                        while (key[strlen(key)-1] == ' ') // remove trailing spaces
                                key[strlen(key)-1] = 0;
-                       if (!COM_ParseTokenConsole(&data))
+                       if (!COM_ParseToken_Simple(&data, false))
                                break; // error
                        strlcpy(value, com_token, sizeof(value));
 
index 15a7289..0fcde55 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -2016,7 +2016,7 @@ int SV_ParticleEffectIndex(const char *name)
                                argc = 0;
                                for (;;)
                                {
-                                       if (!COM_ParseToken(&text, true) || !strcmp(com_token, "\n"))
+                                       if (!COM_ParseToken_Simple(&text, true) || !strcmp(com_token, "\n"))
                                                break;
                                        if (argc < 16)
                                        {