30 fReadMantisseR =
true;
31 fReadMantisseF =
false;
32 fReadExponentSign =
false;
33 fReadExponent =
false;
36 fExponentNegative =
false;
51 if (
InFile_Open(&inStream.file, fileName.c_str()) != 0) {
52 cout <<
"Cannot open input file: " << fileName << endl;
53 cout <<
"First use: \n\t \'lzma --best " << fileName.substr(0, fileName.rfind(
".lzma")) <<
"\'"
54 <<
" to create it. " << endl;
67 for (i = 0; i < 8; i++)
81 if (fStorage.empty()) {
82 const int ret = DecodeBuffer();
84 cout <<
"Error in ReadNextNumber ret=" << ret << endl;
89 data = fStorage.front();
95 for (
int i = 0;
i < length; ++
i) {
96 if (fStorage.empty()) {
97 const int ret = DecodeBuffer();
99 cout <<
"Error in FillArray i=" <<
i <<
" ret=" << ret << endl;
104 data[
i] = fStorage.front();
148 const int thereIsSize = (unpackSize != (
UInt64)(
Int64)-1);
150 if (inPos == inSize) {
152 RINOK(stream->
Read(stream, inBuf, &inSize));
156 SizeT inProcessed = inSize - inPos;
161 if (thereIsSize && outProcessed > unpackSize) {
162 outProcessed = (
SizeT)unpackSize;
167 inPos += inProcessed;
168 unpackSize -= outProcessed;
170 const char *strBuf = (
const char *)outBuf;
175 if (countC >=
int(outProcessed)) {
182 const char &
C = strBuf[countC];
187 if (C ==
' ' || C ==
'\n') {
196 const double number = (fNegative ? -1 : 1) * (fMantisseR + fMantisseF /
pow(10, fMantisseFcount)) *
197 pow(10, (fExponentNegative ? -1 : 1) * fExponent);
200 fStorage.push(number);
203 fStartNumber =
false;
206 fReadMantisseR =
true;
207 fReadMantisseF =
false;
208 fReadExponentSign =
false;
209 fReadExponent =
false;
212 fExponentNegative =
false;
223 const int num = C -
'0';
224 if (num >= 0 && num <= 9) {
225 if (fReadMantisseR) {
227 fMantisseR = fMantisseR * 10 +
num;
228 }
else if (fReadMantisseF) {
230 fMantisseF = fMantisseF * 10 +
num;
232 }
else if (fReadExponent) {
233 fReadExponentSign =
false;
234 fExponent = fExponent * 10 +
num;
243 fReadMantisseR =
true;
244 }
else if (fReadExponentSign) {
245 fExponentNegative =
true;
246 fReadExponentSign =
false;
247 fReadExponent =
true;
249 cout <<
"LzmaFile: found \'" << C <<
"\' at wrong position. " << endl;
254 if (!fReadMantisseR) {
255 cout <<
"LzmaFile: found \'" << C <<
"\' at wrong position. " << endl;
258 fReadMantisseR =
false;
259 fReadMantisseF =
true;
265 if (!fReadMantisseR || !fReadMantisseF) {
266 fReadMantisseR =
false;
267 fReadMantisseF =
false;
268 fReadExponentSign =
true;
269 fReadExponent =
true;
273 cout <<
"LzmaFile: found \'" << C <<
"\' at wrong position. " << endl;
294 if (res !=
SZ_OK || (thereIsSize && unpackSize == 0))
297 if (inProcessed == 0 && outProcessed == 0) {
309 int thereIsSize = (unpackSize != (
UInt64)(
Int64)-1);
312 if (inPos == inSize) {
314 RINOK(stream->
Read(stream, inBuf, &inSize));
318 SizeT inProcessed = inSize - inPos;
323 if (thereIsSize && outProcessed > unpackSize) {
324 outProcessed = (
SizeT)unpackSize;
329 inPos += inProcessed;
330 unpackSize -= outProcessed;
333 for (k = 0; k < outProcessed; ++
k) {
337 if (res !=
SZ_OK || (thereIsSize && unpackSize == 0))
340 if (inProcessed == 0 && outProcessed == 0) {
void LzmaDec_Free(CLzmaDec *p, ISzAlloc *alloc)
tuple ret
prodAgent to be discontinued
void * MyAlloc(size_t size)
static void * SzAlloc(void *, size_t size)
unsigned long long int UInt64
void MyFree(void *address)
SRes SeqInStream_Read(ISeqInStream *stream, void *buf, size_t size)
SRes ReadNextNumber(double &data)
static void SzFree(void *, void *address)
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
void File_Construct(CSzFile *p)
const char * kDataErrorMessage
const char * kCantReadMessage
const char * kCantWriteMessage
SRes FillArray(double *data, const int length)
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
const char * kCantAllocateMessage
#define LzmaDec_Construct(p)
WRes File_Close(CSzFile *p)
char data[epos_bytes_allocation]
void FileSeqInStream_CreateVTable(CFileSeqInStream *p)
void LzmaDec_Init(CLzmaDec *p)
SRes LzmaDec_DecodeToBuf(CLzmaDec *p, Byte *dest, SizeT *destLen, const Byte *src, SizeT *srcLen, ELzmaFinishMode finishMode, ELzmaStatus *status)
SRes LzmaDec_Allocate(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAlloc *alloc)
SRes Open(const std::string &fileName)
SRes(* Read)(void *p, void *buf, size_t *size)
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
WRes InFile_Open(CSzFile *p, const char *name)