Euphoria
decompress.h
Go to the documentation of this file.
1 // clang-tidy: ignore
2 
3 #pragma once
4 
5 namespace eu::core
6 {
7  // Decompress is slighly modified code from the imgui repo, only to remove the use of global variables
8  // this is mainly here so we can use the handy compression tool from the imgui distro for files other than fonts
9  //
10  // The following note is from imgui repo comment:
11  //
12  //-----------------------------------------------------------------------------
13  // Compressed with stb_compress() then converted to a C array and encoded as base85.
14  // Use the program in misc/fonts/binary_to_compressed_c.cpp to create the array from a TTF file.
15  // The purpose of encoding as base85 instead of "0x00,0x01,..." style is only save on _source code_ size.
16  // Decompression from stb.h (public domain) by Sean Barrett https://github.com/nothings/stb/blob/master/stb.h
17  //-----------------------------------------------------------------------------
18 
19  struct Decompressor
20  {
21  unsigned char* stb_barrier_out_e = nullptr, * stb_barrier_out_b = nullptr;
22  const unsigned char* stb_barrier_in_b = nullptr;
23  unsigned char* stb_dout = nullptr;
24 
25  unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int /*length*/);
26  void stb_match(const unsigned char *data, unsigned int length);
27  void stb_lit(const unsigned char *data, unsigned int length);
28  const unsigned char *stb_decompress_token(const unsigned char *i);
29  unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, unsigned int buflen);
30 
31  static unsigned int stb_decompress_length(const unsigned char* input);
32  };
33 
34 }
std::string buffer
Definition: nlp_sentence.cc:87
unsigned int stb_decompress(unsigned char *output, const unsigned char *i, unsigned int)
Definition: decompress.cc:86
static unsigned int stb_decompress_length(const unsigned char *input)
Definition: decompress.cc:11
void stb_match(const unsigned char *data, unsigned int length)
Definition: decompress.cc:16
const unsigned char * stb_decompress_token(const unsigned char *i)
Definition: decompress.cc:38
unsigned char * stb_barrier_out_e
Definition: decompress.h:21
const unsigned char * stb_barrier_in_b
Definition: decompress.h:22
unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, unsigned int buflen)
Definition: decompress.cc:55
unsigned char * stb_barrier_out_b
Definition: decompress.h:21
unsigned char * stb_dout
Definition: decompress.h:23
void stb_lit(const unsigned char *data, unsigned int length)
Definition: decompress.cc:25