Skip to content

Commit

Permalink
Minor changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nzeemin committed Jan 18, 2020
1 parent b724eb6 commit 8d90175
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 28 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ UKNCBTL emulator utilities.

Windows build: [![Build status](https://ci.appveyor.com/api/projects/status/y2mk1kliaxb8n71c?svg=true)](https://ci.appveyor.com/project/nzeemin/ukncbtl-utils)
Linux/Mac: [![Build Status](https://travis-ci.org/nzeemin/ukncbtl-utils.svg?branch=master)](https://travis-ci.org/nzeemin/ukncbtl-utils)
[![CodeFactor](https://www.codefactor.io/repository/github/nzeemin/ukncbtl-utils/badge)](https://www.codefactor.io/repository/github/nzeemin/ukncbtl-utils)

Utilites:
* [ESCParser](https://github.com/nzeemin/ukncbtl-utils/wiki/ESCParser) — ESC/P parser/interpreter with PostScript/SVG/PDF output.
Expand All @@ -15,8 +16,12 @@ Utilites:

-----
The UKNCBTL project consists of:
* [ukncbtl](https://github.com/nzeemin/ukncbtl/) written for Win32 and works under Windows 2000/2003/2008/XP/Vista/7.
* [ukncbtl](https://github.com/nzeemin/ukncbtl/) written for Win32 and works under Windows 2000/2003/2008/XP/Vista/7/8/10.
* [ukncbtl-renders](https://github.com/nzeemin/ukncbtl-renders/) — renderers for UKNCBTL Win32.
* [ukncbtl-qt](https://github.com/nzeemin/ukncbtl-qt/) is based on Qt framework and works under Windows, Linux and Mac OS X.
* [ukncbtl-testbench](https://github.com/nzeemin/ukncbtl-testbench/) — test bench for regression testing.
* [ukncbtl-utils](https://github.com/nzeemin/ukncbtl-utils/) — various utilities: rt11dsk, sav2wav, UkncComSender, ESCParser.
* [ukncbtl-testbench](https://github.com/nzeemin/ukncbtl-testbench/) — test bench for regression and performance testing.
* [ukncbtl-utils](https://github.com/nzeemin/ukncbtl-utils/) — various utilities: rt11dsk, sav2wav, ESCParser etc.
* [ukncbtl-doc](https://github.com/nzeemin/ukncbtl-doc/) — documentation and screenshots.
* Project wiki: https://github.com/nzeemin/ukncbtl-doc/wiki
* Screenshots: https://github.com/nzeemin/ukncbtl-doc/wiki/Screenshots-ru
* User's Manual (in Russian): https://github.com/nzeemin/ukncbtl-doc/wiki/Users-Manual-ru
21 changes: 1 addition & 20 deletions Sav2Cartridge/LZ4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class smallz4
// write several bytes, see sendBytesToOut() in smallz4.cpp for a basic implementation
typedef void(*SEND_BYTES)(const void* data, size_t numBytes);


/// compress everything in input stream (accessed via getByte) and write to output stream (via send)
static void lz4(GET_BYTES getBytes, SEND_BYTES sendBytes,
unsigned int maxChainLength = MaxChainLength,
Expand All @@ -64,13 +63,6 @@ class smallz4
obj.compress(getBytes, sendBytes, dictionary, useLegacyFormat);
}

/// version string
static const char* const getVersion()
{
return "1.3";
}


// compression level thresholds, made public because I display them in the help screen ...
enum
{
Expand All @@ -80,11 +72,7 @@ class smallz4
ShortChainsLazy = 6
};

// ----- END OF PUBLIC INTERFACE -----
private:

// ----- constants and types -----

/// a block can be 4 MB
typedef uint32_t Length;
/// matches must start within the most recent 64k
Expand Down Expand Up @@ -128,8 +116,6 @@ class smallz4
MaxBlockSizeLegacy = 8 * 1024 * 1024
};

// ----- one and only variable ... -----

/// how many matches are checked in findLongestMatch, lower values yield faster encoding at the cost of worse compression ratio
unsigned int maxChainLength;

Expand All @@ -150,21 +136,18 @@ class smallz4
Distance distance;
};


/// create new compressor (only invoked by lz4)
explicit smallz4(unsigned int newMaxChainLength = MaxChainLength)
: maxChainLength(newMaxChainLength) // => no limit, but can be changed by setMaxChainLength
{
}


/// return true, if the four bytes at *a and *b match
inline static bool match4(const void* const a, const void* const b)
{
return *(const uint32_t*)a == *(const uint32_t*)b;
}


/// find longest match of data[pos] between data[begin] and data[end], use match chain stored in previous
Match findLongestMatch(const unsigned char* const data,
size_t pos, size_t begin, size_t end,
Expand Down Expand Up @@ -253,7 +236,6 @@ class smallz4
return result;
}


/// create shortest output
/** data points to block's begin; we need it to extract literals **/
static std::vector<unsigned char> selectBestMatches(const std::vector<Match>& matches,
Expand Down Expand Up @@ -356,7 +338,6 @@ class smallz4
return result;
}


/// walk backwards through all matches and compute number of compressed bytes from current position to the end of the block
/** note: matches are modified (shortened length) if necessary **/
static void estimateCosts(std::vector<Match>& matches)
Expand Down Expand Up @@ -446,7 +427,6 @@ class smallz4
}
}


/// compress everything in input stream (accessed via getByte) and write to output stream (via send), improve compression with a predefined dictionary
void compress(GET_BYTES getBytes, SEND_BYTES sendBytes, const std::vector<unsigned char>& dictionary, bool useLegacyFormat) const
{
Expand Down Expand Up @@ -772,6 +752,7 @@ class smallz4
}
};


//////////////////////////////////////////////////////////////////////


Expand Down
1 change: 0 additions & 1 deletion rt11dsk/diskimage.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ class CDiskImage
private:
void PostAttach();
long GetBlockOffset(int nBlock) const;

};


Expand Down
7 changes: 3 additions & 4 deletions rt11dsk/rt11date.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ UKNCBTL. If not, see <http://www.gnu.org/licenses/>. */

uint16_t clock2rt11date(const time_t clock)
{
union rt11date r = {0};
uint16_t year;
struct tm *v = ::localtime(&clock);
year = v->tm_year + 1900 - 1972;
union rt11date r = {0};
struct tm *v = ::localtime(&clock);
int year = v->tm_year + 1900 - 1972;
r.i.year = year % 32;
r.i.mon = v->tm_mon + 1;
r.i.day = v->tm_mday;
Expand Down

0 comments on commit 8d90175

Please sign in to comment.