Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ News
What's new:
* Support for newer Linux distros (newer gcc)
* Support for Visual Studio and latest Windows versions
* Bug fixes (?)
* Alignment with C++ coding standards
***
03-Jan-2025: Version 0.9.5-HF1 is here

Expand Down
6 changes: 3 additions & 3 deletions specs/src/cli/splitter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#include <string>
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include "utils/platform.h"
#include "utils/directives.h"
#include "utils/ErrorReporting.h"
Expand Down
18 changes: 8 additions & 10 deletions specs/src/cli/tokens.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <string.h>
#include <cstring>
#include <regex>
#include <cctype>
#include "utils/platform.h"
Expand Down Expand Up @@ -176,7 +176,7 @@ static PTokenFieldRange parseAsSingleNumber(std::string s)
long int l;
try {
l = std::stol(s);
} catch(std::invalid_argument& e) {
} catch(std::invalid_argument&) {
return nullptr;
}
if (l==0 || s!=std::to_string(l)) {
Expand All @@ -195,7 +195,7 @@ static PTokenFieldRange parseAsFromToRange(std::string s)
long int _from, _to;
try {
_from = std::stol(s, &posOfHyphen);
} catch(std::invalid_argument& e) {
} catch(std::invalid_argument&) {
return nullptr;
}
if (_from==0 || s.substr(0,posOfHyphen)!=std::to_string(_from)
Expand All @@ -215,7 +215,7 @@ static PTokenFieldRange parseAsFromToRange(std::string s)
return nullptr;
}
}
} catch (std::invalid_argument& e) {
} catch (std::invalid_argument&) {
if (s.substr(posOfHyphen+1)=="*") {
_to = LAST_POS_END;
} else {
Expand All @@ -232,15 +232,15 @@ static PTokenFieldRange parseAsFromLenRange(std::string s)
long int _from, _to, _len;
try {
_from = std::stol(s, &posOfDot);
} catch(std::invalid_argument& e) {
} catch(std::invalid_argument&) {
return nullptr;
}
if (_from==0 || s.substr(0,posOfDot)!=std::to_string(_from) || s[posOfDot]!='.') {
return nullptr;
}
try {
_len = std::stol(s.substr(posOfDot+1));
} catch (std::invalid_argument& e) {
} catch (std::invalid_argument&) {
return nullptr;
}
if (_len<=0 || s.substr(posOfDot+1)!=std::to_string(_len)) {
Expand Down Expand Up @@ -436,9 +436,7 @@ void parseSingleToken(std::vector<Token> *pVec, std::string arg, int argidx)
} else {
goto CONT1;
}
} catch (std::invalid_argument& e) {
goto CONT1;
} catch (std::out_of_range& e) {
} catch (...) {
goto CONT1;
}
}
Expand Down Expand Up @@ -479,7 +477,7 @@ void parseSingleToken(std::vector<Token> *pVec, std::string arg, int argidx)
Token(TokenListType__LITERAL, nullptr /* range */,
literal, argidx, arg));
NEXT_TOKEN;
} catch(ConversionException& e) {
} catch(ConversionException&) {
; // Do nothing. It just wasn't a hex string
}
}
Expand Down
2 changes: 1 addition & 1 deletion specs/src/cli/tokens.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Token {
int argIndex() {return m_argc;}
std::string& Orig() {return m_orig;}
std::string& HelpIdentify();
void deallocDynamic() {/* - TODO: ERASE -- if (m_pRange) {m_pRange = NULL;} */} // do we even need this method?
void deallocDynamic() {/* - TODO: ERASE -- if (m_pRange) {m_pRange = nullptr;} */} // do we even need this method?
private:
TokenListTypes m_type;
PTokenFieldRange m_pRange;
Expand Down
2 changes: 1 addition & 1 deletion specs/src/processing/Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <string.h>
#include <cstring>
#ifdef WIN64
#include <windows.h>
#else
Expand Down
44 changes: 22 additions & 22 deletions specs/src/processing/ProcessingState.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,34 @@ class ProcessingState : public stateQueryAgent {
void setStringInPlace(PSpecString ps);

// The stateQueryAgent interface
virtual unsigned int getWordCount();
virtual unsigned int getFieldCount();
virtual int getWordStart(int idx);
virtual int getWordEnd(int idx);
virtual int getFieldStart(int idx);
virtual int getFieldEnd(int idx);
virtual PSpecString getFromTo(int from, int to);
virtual bool isRunIn() { return (m_CycleCounter==1); }
virtual bool isRunOut() { return (m_ps==nullptr); } // NOTE: will return true before first record
virtual ALUInt getRecordCount() { return ALUInt(m_CycleCounter + m_ExtraReads); }
virtual ALUInt getIterationCount() { return ALUInt(m_CycleCounter); }
virtual bool breakEstablished(char id);
virtual PAluValueStats valueStatistics(char id);
virtual PFrequencyMap getFrequencyMap(char id);
unsigned int getWordCount() override;
unsigned int getFieldCount() override;
int getWordStart(int idx) override;
int getWordEnd(int idx) override;
int getFieldStart(int idx) override;
int getFieldEnd(int idx) override;
PSpecString getFromTo(int from, int to) override;
bool isRunIn() override { return (m_CycleCounter==1); }
bool isRunOut() override { return (m_ps==nullptr); } // NOTE: will return true before first record
ALUInt getRecordCount() override { return ALUInt(m_CycleCounter + m_ExtraReads); }
ALUInt getIterationCount() override { return ALUInt(m_CycleCounter); }
bool breakEstablished(char id) override;
PAluValueStats valueStatistics(char id) override;
PFrequencyMap getFrequencyMap(char id) override;

void fieldIdentifierSet(char id, PSpecString ps);
void incrementCycleCounter() { m_CycleCounter++; }
void incrementExtraReads() { m_ExtraReads++; }
PSpecString fieldIdentifierGet(char id);
bool fieldIdentifierIsSet(char id);
bool fieldIdentifierIsSet(char id) override;
PSpecString extractCurrentRecord();
void fieldIdentifierClear();
void fieldIdentifierStatsClear();

void alterFieldSeparator(const std::string& sep);
std::string& getFieldSeparator();
void alterWordSeparator(const std::string& sep);
std::string& getWordSeparator();
void alterFieldSeparator(const std::string& sep) override;
std::string& getFieldSeparator() override;
void alterWordSeparator(const std::string& sep) override;
std::string& getWordSeparator() override;

void breakValuesClear();
void resetBreaks();
Expand All @@ -88,7 +88,7 @@ class ProcessingState : public stateQueryAgent {
void setSecond();
void setStream(int i);
int getActiveInputStation() { return m_inputStation; }
virtual PSpecString currRecord() { return (m_inputStation==STATION_FIRST) ? m_ps : m_prevPs; }
PSpecString currRecord() override { return (m_inputStation==STATION_FIRST) ? m_ps : m_prevPs; }
bool recordNotAvailable() { return nullptr==currRecord(); }
bool inputStreamHasChanged() { return m_inputStreamChanged; }
void resetInputStreamFlag() { m_inputStreamChanged = false; }
Expand Down Expand Up @@ -144,8 +144,8 @@ class ProcessingState : public stateQueryAgent {
class ProcessingStateFieldIdentifierGetter : public fieldIdentifierGetter {
public:
ProcessingStateFieldIdentifierGetter(ProcessingState* _ps) : m_ps(_ps) {}
~ProcessingStateFieldIdentifierGetter() {}
std::string Get(char id);
~ProcessingStateFieldIdentifierGetter() override {}
std::string Get(char id) override;
private:
ProcessingState* m_ps;
};
Expand Down
2 changes: 1 addition & 1 deletion specs/src/processing/Reader.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <string.h>
#include <cstring>
#include <fstream>
#include "utils/ErrorReporting.h"
#include "Config.h"
Expand Down
42 changes: 21 additions & 21 deletions specs/src/processing/Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ class Reader {
unsigned long m_countRead;
unsigned long m_countUsed;
bool m_bAbort;
bool m_bRanDry; // true *after* the reader returned NULL once
bool m_bRanDry; // true *after* the reader returned nullptr once
classifyingTimer m_Timer;
};

typedef std::shared_ptr<Reader> PReader;

class TestReader : public Reader {
public:
TestReader(size_t maxLineCount);
virtual ~TestReader();
explicit TestReader(size_t maxLineCount);
~TestReader() override;
void InsertString(const char* s);
void InsertString(PSpecString ps);
virtual bool endOfSource() {return m_bAbort || (m_idx >= m_count); }
virtual PSpecString getNextRecord() {return mp_arr[m_idx++];}
virtual PSpecString get(classifyingTimer& tmr, unsigned int& _readerCounter) {return getNextRecord();}
bool endOfSource() override {return m_bAbort || (m_idx >= m_count); }
PSpecString getNextRecord() override {return mp_arr[m_idx++];}
PSpecString get(classifyingTimer& tmr, unsigned int& _readerCounter) override {return getNextRecord();}
private:
PSpecString *mp_arr;
size_t m_count;
Expand All @@ -78,14 +78,14 @@ enum recordFormat {
class StandardReader : public Reader {
public:
StandardReader(); /* simple constructor - stdin becomes the source */
StandardReader(std::istream* f);
StandardReader(std::string& fn);
StandardReader(pipeType pipe);
virtual ~StandardReader();
virtual bool endOfSource();
virtual PSpecString getNextRecord();
virtual void setFormatFixed(unsigned int lrecl, bool blocked);
virtual void setLineDelimiter(char c);
explicit StandardReader(std::istream* f);
explicit StandardReader(std::string& fn);
explicit StandardReader(pipeType pipe);
~StandardReader() override;
bool endOfSource() override;
PSpecString getNextRecord() override;
void setFormatFixed(unsigned int lrecl, bool blocked) override;
void setLineDelimiter(char c) override;
private:
std::shared_ptr<std::istream> m_File;
pipeType m_pipe;
Expand All @@ -104,16 +104,16 @@ typedef std::shared_ptr<StandardReader> PStandardReader;

class multiReader : public Reader {
public:
multiReader(PReader pDefaultReader); // Please don't initiate with another multiReader...
virtual ~multiReader();
explicit multiReader(PReader pDefaultReader); // Please don't initiate with another multiReader...
~multiReader() override;
void addStream(unsigned char idx, std::istream* f);
void addStream(unsigned char idx, std::string& fn);
using Reader::selectStream; // prevent a warning about overloading
virtual void selectStream(unsigned char idx, PSpecString* ppRecord);
virtual bool endOfSource();
virtual PSpecString getNextRecord();
virtual PSpecString get(classifyingTimer& tmr, unsigned int& _readerCounter);
virtual void Begin();
void selectStream(unsigned char idx, PSpecString* ppRecord);
bool endOfSource() override;
PSpecString getNextRecord() override;
PSpecString get(classifyingTimer& tmr, unsigned int& _readerCounter) override;
void Begin() override;
void End();
unsigned int getReaderIdx() { return readerIdx+1; }
void setStopReader(int idx) { stopReaderIdx = idx; }
Expand Down
2 changes: 1 addition & 1 deletion specs/src/processing/StringBuilder.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <string.h> // for memcpy
#include <cstring> // for memcpy
#include "Config.h"
#include "utils/ErrorReporting.h"
#include "ProcessingState.h"
Expand Down
16 changes: 8 additions & 8 deletions specs/src/processing/Writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ class SimpleWriter : public Writer {
writerType__SHELL,
writerType__FILE
};
SimpleWriter(writerType typ);
SimpleWriter(const std::string& fn);
virtual ~SimpleWriter();
virtual void WriteOut();
explicit SimpleWriter(writerType typ);
explicit SimpleWriter(const std::string& fn);
~SimpleWriter() override;
void WriteOut() override;
private:
virtual void WriteOutDo(PSpecString ps, classifyingTimer& tmr);
void WriteOutDo(PSpecString ps, classifyingTimer& tmr) override;
std::shared_ptr<std::ostream> m_File;
writerType m_WriterType;
};
Expand All @@ -59,9 +59,9 @@ typedef std::shared_ptr<SimpleWriter> PSimpleWriter;
class StringWriter : public Writer {
public:
StringWriter() {}
virtual ~StringWriter() {}
virtual void WriteOut() {}
virtual void WriteOutDo(PSpecString ps, classifyingTimer& tmr)
~StringWriter() override {}
void WriteOut() override {}
void WriteOutDo(PSpecString ps, classifyingTimer& tmr) override
{
m_queue.push(ps);
}
Expand Down
2 changes: 1 addition & 1 deletion specs/src/processing/conversions.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <string.h>
#include <cstring>
#include <stdexcept>
#include <sstream>
#include <iomanip>
Expand Down
Loading