- implemented the parser basics of a ZScript versioning system.
Note that this completely disables the newly added keywords 'play' and 'ui' for unversioned code to allow using them as identifiers as I have found at least one mod that uses a variable named 'play' that would have been rendered broken otherwise. This also disables many ZScript only keywords for other parsing jobs.
This commit is contained in:
parent
5d3244c3a7
commit
7df698dad8
20 changed files with 268 additions and 144 deletions
|
|
@ -42,6 +42,31 @@
|
|||
|
||||
// CODE --------------------------------------------------------------------
|
||||
|
||||
void VersionInfo::operator=(const char *string)
|
||||
{
|
||||
char *endp;
|
||||
major = (int16_t)clamp<unsigned long long>(strtoull(string, &endp, 10), 0, USHRT_MAX);
|
||||
if (*endp == '.')
|
||||
{
|
||||
minor = (int16_t)clamp<unsigned long long>(strtoull(endp + 1, &endp, 10), 0, USHRT_MAX);
|
||||
if (*endp == '.')
|
||||
{
|
||||
revision = (int16_t)clamp<unsigned long long>(strtoull(endp + 1, &endp, 10), 0, USHRT_MAX);
|
||||
if (*endp != 0) major = USHRT_MAX;
|
||||
}
|
||||
else if (*endp == 0)
|
||||
{
|
||||
revision = 0;
|
||||
}
|
||||
else major = USHRT_MAX;
|
||||
}
|
||||
else if (*endp == 0)
|
||||
{
|
||||
minor = revision = 0;
|
||||
}
|
||||
else major = USHRT_MAX;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FScanner Constructor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue