mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
ec17f5a5b9
error handling. - Fixed: dehsupp/scanner.re defined "}" as the token RPAREN. dehsupp/parse.y also defined action_list_def as needing a RBARCE. I'm surprised it worked at all before. I guess Lemon really was too accepting. - Changed the way that xlatcc handles include statements so that I don't need to modify the logic of lempar.c. I also discovered that the grammar was improperly defined and only accepted the first statement. It worked before because Lemon used to accept multiple times before reaching the EOF token. I have also verified that it is still generating the proper lumps. - Removed some unused wadsrc files from the repository. - Fixed my re2c upgrade. - Updated lemon.c to v1.53. SVN r711 (trunk)
62 lines
832 B
C++
62 lines
832 B
C++
/* $Id: substr.cc 546 2006-05-25 13:40:14Z helly $ */
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include "substr.h"
|
|
#include "globals.h"
|
|
|
|
#ifndef HAVE_STRNDUP
|
|
|
|
char *strndup(const char *str, size_t len)
|
|
{
|
|
char * ret = (char*)malloc(len + 1);
|
|
|
|
memcpy(ret, str, len);
|
|
ret[len] = '\0';
|
|
return ret;
|
|
}
|
|
|
|
#endif
|
|
|
|
namespace re2c
|
|
{
|
|
|
|
void SubStr::out(std::ostream& o) const
|
|
{
|
|
o.write(str, len);
|
|
}
|
|
|
|
bool operator==(const SubStr &s1, const SubStr &s2)
|
|
{
|
|
return (bool) (s1.len == s2.len && memcmp(s1.str, s2.str, s1.len) == 0);
|
|
}
|
|
|
|
Str::Str(const SubStr& s)
|
|
: SubStr(strndup(s.str, s.len), s.len)
|
|
{
|
|
;
|
|
}
|
|
|
|
Str::Str(Str& s)
|
|
: SubStr(s.str, s.len)
|
|
{
|
|
s.str = NULL;
|
|
s.len = 0;
|
|
}
|
|
|
|
Str::Str()
|
|
: SubStr((char*) NULL, 0)
|
|
{
|
|
;
|
|
}
|
|
|
|
|
|
Str::~Str()
|
|
{
|
|
if (str) {
|
|
free((void*)str);
|
|
}
|
|
str = (char*) - 1;
|
|
len = (uint) - 1;
|
|
}
|
|
|
|
} // end namespace re2c
|