diff --git a/api/generator.h b/api/generator.h index 7fbaec2..3e6c793 100644 --- a/api/generator.h +++ b/api/generator.h @@ -376,7 +376,8 @@ class Parameter public: Parameter( int order, int sequence, int valueCount, std::wstring name, bool expectedResultParam ) : m_order( order ), m_sequence( sequence ), m_valueCount( valueCount ), - m_name( name ), m_expResultParam( expectedResultParam ), m_valueWeights( 0 ) + m_name( name ), m_expResultParam( expectedResultParam ), m_valueWeights( 0 ), + m_bound( false ), m_pending( false ), m_avgExclusionSize( 0 ) { // result params must have order = 1 if ( m_expResultParam ) m_order = 1; diff --git a/cli/ccommon.h b/cli/ccommon.h index 7b9e28c..01f8ec8 100644 --- a/cli/ccommon.h +++ b/cli/ccommon.h @@ -97,8 +97,8 @@ const LogicalOperPriority LogicalOperPriority_OR = 1; class CValue { public: - CValue( IN std::wstring text ) : DataType( DataType_String ), Text( text ) {} - CValue( IN double number ) : DataType( DataType_Number ), Number( number ) {} + CValue( IN std::wstring text ) : DataType( DataType_String ), Text( text ), Number( 0 ) {} + CValue( IN double number ) : DataType( DataType_Number ), Text( L"" ), Number( number ) {} pictcli_constraints::DataType DataType; std::wstring Text; diff --git a/cli/gcd.cpp b/cli/gcd.cpp index 0bcb376..9675042 100644 --- a/cli/gcd.cpp +++ b/cli/gcd.cpp @@ -1,7 +1,7 @@ #include "gcd.h" using namespace std; -#define FAILED(err) (ErrorCode_Success != (err)) +#define FAILED(err) (ErrorCode::ErrorCode_Success != (err)) namespace pictcli_gcd { @@ -19,7 +19,7 @@ ErrorCode GcdRunner::generateResults( IN CModelData& modelData, IN bool justNega // check if we excluded all values of any parameter; generation will return nothing if that's the case if( gcdData.CheckEntireParameterExcluded() ) { - return( ErrorCode_BadConstraints ); + return( ErrorCode::ErrorCode_BadConstraints ); } // save all one-element exclusions, they'll be used for warnings later @@ -41,7 +41,7 @@ ErrorCode GcdRunner::generateResults( IN CModelData& modelData, IN bool justNega // each submodel may assign different order to parameters if( !gcdData.FixParamOrder( submodel )) { - return( ErrorCode_BadModel ); + return( ErrorCode::ErrorCode_BadModel ); } if( modelData.Verbose ) @@ -57,7 +57,7 @@ ErrorCode GcdRunner::generateResults( IN CModelData& modelData, IN bool justNega if( !gcdData.FixParamOrder( model )) { - return( ErrorCode_BadModel ); + return( ErrorCode::ErrorCode_BadModel ); } if( modelData.Verbose ) @@ -96,12 +96,12 @@ ErrorCode GcdRunner::generateResults( IN CModelData& modelData, IN bool justNega assert( false ); throw; #endif - return( ErrorCode_GenerationError ); + return( ErrorCode::ErrorCode_GenerationError ); } translateResults( modelData, model->GetResults(), justNegative ); - return( ErrorCode_Success ); + return( ErrorCode::ErrorCode_Success ); } // @@ -180,7 +180,7 @@ ErrorCode GcdRunner::Generate() if( FAILED( err )) return( err ); } - return( ErrorCode_Success ); + return( ErrorCode::ErrorCode_Success ); } } \ No newline at end of file diff --git a/cli/gcdmodel.cpp b/cli/gcdmodel.cpp index cf3b80b..a5d9cfd 100644 --- a/cli/gcdmodel.cpp +++ b/cli/gcdmodel.cpp @@ -266,7 +266,7 @@ ErrorCode CGcdData::TranslateToGCD() // make sure all order fields in models are set appropriately if( !fixModelAndSubmodelOrder() ) { - return( ErrorCode_BadModel ); + return( ErrorCode::ErrorCode_BadModel ); } // add exclusions for negative values @@ -278,7 +278,7 @@ ErrorCode CGcdData::TranslateToGCD() ConstraintsInterpreter interpreter( _modelData, Parameters ); if( !interpreter.ConvertToExclusions( Exclusions ) ) { - return( ErrorCode_BadConstraints ); + return( ErrorCode::ErrorCode_BadConstraints ); } _constraintWarnings.assign( interpreter.GetWarnings().begin(), interpreter.GetWarnings().end() ); @@ -308,7 +308,7 @@ ErrorCode CGcdData::TranslateToGCD() PrintGcdExclusions(); } - return( ErrorCode_Success ); + return( ErrorCode::ErrorCode_Success ); } // diff --git a/cli/gcdmodel.h b/cli/gcdmodel.h index fb04de1..ec75e36 100644 --- a/cli/gcdmodel.h +++ b/cli/gcdmodel.h @@ -10,7 +10,7 @@ namespace pictcli_gcd // // // -enum ErrorCode +enum class ErrorCode { ErrorCode_Success = 0x00, ErrorCode_OutOfMemory = 0x01, diff --git a/cli/model.h b/cli/model.h index 418e1d8..0b82312 100644 --- a/cli/model.h +++ b/cli/model.h @@ -58,8 +58,10 @@ public: Parameter* GcdPointer; CModelParameter() : - IsResultParameter( false ), - GcdPointer( nullptr ) {} + Name(nullptr), + IsResultParameter(false), + Order(UNDEFINED_ORDER), + GcdPointer(nullptr){} int GetValueOrdinal( IN std::wstring& name, IN bool caseSensitive ); bool ValueNamesUnique( IN bool CaseSensitive ); diff --git a/cli/pict.cpp b/cli/pict.cpp index eb46013..fc50ed8 100644 --- a/cli/pict.cpp +++ b/cli/pict.cpp @@ -52,25 +52,25 @@ int __cdecl execute if( !ParseArgs( argc, args, modelData ) ) { - return( ErrorCode_BadOption ); + return( (int)ErrorCode::ErrorCode_BadOption ); } if( !modelData.ReadModel( wstring( args[ 1 ] ))) { - return( ErrorCode_BadModel ); + return( (int)ErrorCode::ErrorCode_BadModel ); } if( !modelData.ReadRowSeedFile( modelData.RowSeedsFile )) { - return( ErrorCode_BadRowSeedFile ); + return( (int)ErrorCode::ErrorCode_BadRowSeedFile ); } GcdRunner gcdRunner( modelData ); ErrorCode err = gcdRunner.Generate(); - if( err != ErrorCode_Success ) + if( err != ErrorCode::ErrorCode_Success ) { - return err; + return (int)err; } time_t end = time( nullptr ); @@ -100,7 +100,7 @@ int __cdecl execute output.append( outputStream.str() ); } - return( ErrorCode_Success ); + return( (int)ErrorCode::ErrorCode_Success ); } // @@ -165,7 +165,7 @@ int main { delete wargs[ ii ]; } - delete wargs; + delete[] wargs; return( ret ); }