Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

iSilo.h

Go to the documentation of this file.
00001 #include <sys/types.h>
00002 #include <sys/stat.h>
00003 #ifndef _WINDOWS
00004 #include <netinet/in.h>
00005 #include <unistd.h>
00006 #include <stdlib.h>
00007 #else
00008 typedef unsigned char u_int8_t;
00009 typedef unsigned short u_int16_t;
00010 typedef unsigned long u_int32_t;
00011 #endif
00012 #include <fcntl.h>
00013 #include <stdio.h>
00014 #include <string.h>
00015 
00016 #include "pdb.h"
00017 
00018 #define VERSION "deSilo version 0.4a by Clement"
00019 
00020 
00021 struct s_tree {
00022   struct s_tree *branch[2];
00023   u_int32_t value;
00024 };
00025 
00026 struct s_attrib {
00027   u_int32_t offset;
00028   u_int16_t value;
00029 };
00030 
00031 struct s_huffman {
00032   struct s_tree *tree;
00033   u_int8_t *size;
00034   u_int16_t *code;
00035   u_int32_t num;
00036 };
00037 
00038 #define HM_SHORT  0x10
00039 #define HM_MEDIUM 0x11
00040 #define HM_LONG   0x12
00041 
00042 class iSilo : public Cpdb
00043 {
00044   CStyle mystyle;
00045   u_int16_t BlockSize;
00046   int pos;
00047   u_int32_t buf[256];
00048   struct s_huffman *master, *lz, *text;
00049   u_int32_t cur_rec;
00050   u_int8_t buffer[4096];
00051   u_int32_t buffer_size;
00052   u_int16_t current_pos, bsize;
00053   u_int32_t filepos, filesize, textsize;
00054   u_int16_t attr_start, attr_end, attr_num, current_attr, attr_rec;
00055   u_int16_t pos_hi;
00056   u_int16_t last_pos, last_value;
00057 
00058 
00059   s_attrib* attr;
00060 
00061 
00062   void init_tables(void);
00063   int code2tree(struct s_huffman *h);
00064   u_int32_t swap_bits(u_int32_t n, int num);
00065   u_int32_t *huffman_get(struct s_huffman *h);
00066   int size2code(struct s_huffman *h);
00067   void read_attr();
00068   struct s_huffman *huffman_create(u_int32_t num);
00069   void kill_tree(struct s_tree *tree);
00070   void kill_huffman(struct s_huffman *h);
00071   int read_size(struct s_huffman *prev, struct s_huffman *h);
00072   void mymemcpy(u_int8_t *dst, u_int8_t *src, u_int32_t num);
00073   int read_tree(struct s_huffman *prev, struct s_huffman *curr);
00074   bool reset_trees();
00075   u_int32_t get_bits(int num);
00076   u_int32_t get_swapped(int num);
00077   int read_text();
00078   u_int32_t getreccode();
00079   bool process_record();
00080 public:
00081   iSilo() : pos(0), master(NULL), lz(NULL), text(NULL), cur_rec(0), buffer_size(4096), current_pos(0), bsize(0), BlockSize(4096)
00082   {
00083   }
00084   ~iSilo();
00085   int getch();
00086   void getch(tchar& ch, CStyle& sty, unsigned long& pos);
00087   MarkupType PreferredMarkup()
00088   {
00089     return cNONE;
00090   }
00091   void sizes(unsigned long& _file, unsigned long& _text)
00092   {
00093     _file = filesize;
00094     _text = textsize;
00095   }
00096   bool hasrandomaccess() { return false; }
00097   int OpenFile(const char* src);
00098   unsigned int locate()
00099   {
00100     return filepos;
00101   }
00102   void locate(unsigned int n);
00103   QString about();
00104 };

Generated on Sat Nov 5 16:16:55 2005 for OPIE by  doxygen 1.4.2