Skip to content

Commit

Permalink
Merge branch 'refactor/tokenizer' into autobuild/tokenizer
Browse files Browse the repository at this point in the history
  • Loading branch information
c-lipka committed Dec 8, 2018
2 parents 86b87b7 + 7d8dc2d commit 4f92aa7
Show file tree
Hide file tree
Showing 13 changed files with 549 additions and 393 deletions.
17 changes: 17 additions & 0 deletions source/base/configbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -1051,12 +1051,29 @@ static_assert(
#define POV_BACKSLASH_IS_PATH_SEPARATOR 0
#endif

/// @def POV_ASSERT
/// Assert a condition that should hold true by design.
/// In debug builds, this macro evaluates the specified expression, and halts execution if the
/// expression does not hold true.
/// In release builds, this macro evaluates to an empty statement.
#if POV_DEBUG
#define POV_ASSERT(expr) POV_ASSERT_HARD(expr)
#else
#define POV_ASSERT(expr) POV_ASSERT_DISABLE(expr)
#endif

/// @def POV_EXPERIMENTAL_ASSERT
/// Assert a condition that is expected to hold true by current understanding of the code.
/// This macro evaluates the specified expression, and halts execution (in debug builds) or throws
/// an exception (in release builds) if the expression does not hold true.
/// @attention
/// This macro is intended for special builds only, and should _never_ be used in mainline versions!
#if POV_DEBUG
#define POV_EXPERIMENTAL_ASSERT(expr) POV_ASSERT_HARD(expr)
#else
#define POV_EXPERIMENTAL_ASSERT(expr) POV_ASSERT_SOFT(expr)
#endif

#if POV_COLOURSPACE_DEBUG
#define POV_COLOURSPACE_ASSERT(expr) POV_ASSERT_HARD(expr)
#else
Expand Down
2 changes: 1 addition & 1 deletion source/base/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
/// where `N` is a serial number starting at 1 in each phase, `TIME` is the number of minutes
/// since 2000-01-01 00:00, and `FEATURE` is an arbitrary alphanumeric moniker for a particular
/// experimental feature.
#define POV_RAY_PRERELEASE "x.tokenizer.9945666"
#define POV_RAY_PRERELEASE "x.tokenizer.9960461"

#if defined(DOXYGEN) && !defined(POV_RAY_PRERELEASE)
// Work around doxygen being unable to document undefined macros.
Expand Down
16 changes: 8 additions & 8 deletions source/core/material/blendmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
/// Copyright 1991-2017 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2018 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -159,17 +159,17 @@ TextureBlendMapPtr Create_Blend_Map<TextureBlendMap> (BlendMapTypeId type)
******************************************************************************/

template<typename MAP_T>
shared_ptr<MAP_T> Copy_Blend_Map (shared_ptr<MAP_T>& Old)
shared_ptr<MAP_T> Copy_Blend_Map (const shared_ptr<MAP_T>& Old)
{
return shared_ptr<MAP_T>(Old);
}

template ColourBlendMapPtr Copy_Blend_Map (ColourBlendMapPtr& Old);
template PigmentBlendMapPtr Copy_Blend_Map (PigmentBlendMapPtr& Old);
template GenericNormalBlendMapPtr Copy_Blend_Map (GenericNormalBlendMapPtr& Old);
template SlopeBlendMapPtr Copy_Blend_Map (SlopeBlendMapPtr& Old);
template NormalBlendMapPtr Copy_Blend_Map (NormalBlendMapPtr& Old);
template TextureBlendMapPtr Copy_Blend_Map (TextureBlendMapPtr& Old);
template ColourBlendMapPtr Copy_Blend_Map (const ColourBlendMapPtr& Old);
template PigmentBlendMapPtr Copy_Blend_Map (const PigmentBlendMapPtr& Old);
template GenericNormalBlendMapPtr Copy_Blend_Map (const GenericNormalBlendMapPtr& Old);
template SlopeBlendMapPtr Copy_Blend_Map (const SlopeBlendMapPtr& Old);
template NormalBlendMapPtr Copy_Blend_Map (const NormalBlendMapPtr& Old);
template TextureBlendMapPtr Copy_Blend_Map (const TextureBlendMapPtr& Old);


/*****************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions source/core/material/blendmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/// @parblock
///
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
/// Copyright 1991-2017 Persistence of Vision Raytracer Pty. Ltd.
/// Copyright 1991-2018 Persistence of Vision Raytracer Pty. Ltd.
///
/// POV-Ray is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -102,7 +102,7 @@ template<typename MAP_T>
shared_ptr<MAP_T> Create_Blend_Map (BlendMapTypeId type);

template<typename MAP_T>
shared_ptr<MAP_T> Copy_Blend_Map (shared_ptr<MAP_T>& Old);
shared_ptr<MAP_T> Copy_Blend_Map (const shared_ptr<MAP_T>& Old);

/// @}
///
Expand Down
20 changes: 10 additions & 10 deletions source/parser/fncode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ FNCode::FNCode(Parser *pa, FunctionCode *f, bool is_local, const char *n)
}

if (n != nullptr)
function->sourceInfo.name = POV_STRDUP(n);
function->sourceInfo.name = n;
else
function->sourceInfo.name = POV_STRDUP("");
function->sourceInfo.fileName = parser->UCS2_strdup(parser->mToken.sourceFile->Name());
function->sourceInfo.position = parser->mToken.raw.lexeme.position;
function->sourceInfo.name = "";
function->sourceInfo.fileName = parser->CurrentFileName();
function->sourceInfo.position = parser->CurrentFilePosition();
function->flags = 0;
function->private_copy_method = nullptr;
function->private_destroy_method = nullptr;
Expand Down Expand Up @@ -166,20 +166,20 @@ FNCode::FNCode(Parser *pa, FunctionCode *f, bool is_local, const char *n)
void FNCode::Parameter()
{
parser->Get_Token();
if(parser->mToken.Token_Id == LEFT_PAREN_TOKEN)
if(parser->CurrentTokenId() == LEFT_PAREN_TOKEN)
{
for(function->parameter_cnt = 0;
((parser->mToken.Token_Id != RIGHT_PAREN_TOKEN) || (function->parameter_cnt == 0)) && (function->parameter_cnt < MAX_FUNCTION_PARAMETER_LIST);
((parser->CurrentTokenId() != RIGHT_PAREN_TOKEN) || (function->parameter_cnt == 0)) && (function->parameter_cnt < MAX_FUNCTION_PARAMETER_LIST);
function->parameter_cnt++)
{
parser->Get_Token();

if((parser->mToken.Function_Id != IDENTIFIER_TOKEN) && (parser->mToken.Function_Id != X_TOKEN) &&
(parser->mToken.Function_Id != Y_TOKEN) && (parser->mToken.Function_Id != Z_TOKEN) &&
(parser->mToken.Function_Id != U_TOKEN) && (parser->mToken.Function_Id != V_TOKEN))
if((parser->CurrentTokenFunctionId() != IDENTIFIER_TOKEN) && (parser->CurrentTokenFunctionId() != X_TOKEN) &&
(parser->CurrentTokenFunctionId() != Y_TOKEN) && (parser->CurrentTokenFunctionId() != Z_TOKEN) &&
(parser->CurrentTokenFunctionId() != U_TOKEN) && (parser->CurrentTokenFunctionId() != V_TOKEN))
parser->Expectation_Error("parameter identifier");

function->parameter[function->parameter_cnt] = POV_STRDUP(parser->mToken.raw.lexeme.text.c_str());
function->parameter[function->parameter_cnt] = POV_STRDUP(parser->CurrentTokenText().c_str());

parser->Parse_Comma();
}
Expand Down
Loading

0 comments on commit 4f92aa7

Please sign in to comment.