indicator.c larc.c lha.h lha_macro.h prototypes.h lhadd.c lharc.c \
lhext.c lhlist.c maketbl.c maketree.c patmatch.c shuf.c slide.c \
util.c getopt_long.c getopt_long.h \
- pm2.c pm2hist.c pm2hist.h pm2tree.c pm2tree.h
+ pm2.c pm2hist.c pm2tree.c
lha_LDADD = @LIBOBJS@
EXTRA_DIST = lhdir.h fnmatch.h
AM_CPPFLAGS=$(DEF_KCODE) $(SUPPORT_LZHUFF_METHOD)
huf.c indicator.c larc.c lhadd.c lharc.c lhext.c
lhlist.c maketbl.c maketree.c patmatch.c
shuf.c slide.c util.c
- pm2.c
+ pm2.c pm2tree.c pm2hist.c
'
test -f prototypes.h && mv -f prototypes.h prototypes.h.bak
pm2.c -- extract pmext2 coding
***********************************************************/
#include "lha.h"
-#include "pm2hist.h"
-#include "pm2tree.h"
static off_t nextcount;
static unsigned long lastupdate;
break;
}
}
- gettree1 = tree_get(&tree1); /* value preserved for decode_p */
+ gettree1 = tree1_get(); /* value preserved for decode_p */
if (gettree1 >= 29) {
error("Bad table");
exit(1);
delta = 0;
}
else if (gettree1 < 28) { /* n-byte repeat with offset 0..8191 */
- gettree2 = tree_get(&tree2);
+ gettree2 = tree2_get();
if (gettree2 == 0) {
nbits = 6;
delta = 0;
+++ /dev/null
-/***********************************************************
- pm2hist.h -- history for pmext2 decoding
-***********************************************************/
-
-/* Circular double-linked list. */
-
-void hist_init();
-unsigned char hist_lookup(int n);
-void hist_update(unsigned char data);
pm2tree.c -- tree for pmext2 decoding
***********************************************************/
#include "lha.h"
-#include "pm2tree.h"
+
+struct tree {
+ unsigned char root, *leftarr, *rightarr;
+};
static unsigned char tree1left[32];
static unsigned char tree1right[32];
-struct tree tree1 = { 0, tree1left, tree1right };
-static unsigned char table1[32];
+static struct tree tree1 = { 0, tree1left, tree1right };
+static unsigned char tree1bound;
static unsigned char tree2left[8];
static unsigned char tree2right[8];
-struct tree tree2 = { 0, tree2left, tree2right };
-static unsigned char table2[8];
+static struct tree tree2 = { 0, tree2left, tree2right };
-static unsigned char tree1bound;
-static unsigned char mindepth;
+static void tree_setsingle(struct tree *t, unsigned char value);
+static void tree_rebuild(struct tree *t, unsigned char bound,
+ unsigned char mindepth, unsigned char maxdepth,
+ unsigned char *table);
+static void tree_setsingle(struct tree *t, unsigned char value);
void
maketree1()
{
int i, nbits, x;
+ unsigned char mindepth;
+ unsigned char table1[32];
+
tree1bound = getbits(5);
mindepth = getbits(3);
maketree2(int tree2bound) /* in use: 5 <= tree2bound <= 8 */
{
int i, count, index;
+ unsigned char mindepth;
+ unsigned char table2[8];
if (tree1bound < 10)
return;
}
-int
+static int
tree_get(struct tree *t)
{
int i;
return i & 0x7F;
}
-void
+int
+tree1_get()
+{
+ return tree_get(&tree1);
+}
+
+int
+tree2_get()
+{
+ return tree_get(&tree2);
+}
+
+static void
tree_setsingle(struct tree *t, unsigned char value)
{
t->root = 128 | value;
}
-void
+static void
tree_rebuild(struct tree *t,
unsigned char bound,
unsigned char mindepth,
+++ /dev/null
-/***********************************************************
- pm2tree.h -- tree for pmext2 decoding
-***********************************************************/
-
-struct tree {
- unsigned char root, *leftarr, *rightarr;
-};
-
-extern struct tree tree1, tree2;
-
-void maketree1();
-void maketree2(int tree2bound);
-int tree_get(struct tree *t);
-void tree_setsingle(struct tree *t, unsigned char value);
-void tree_rebuild(struct tree *t, unsigned char bound,
- unsigned char mindepth, unsigned char maxdepth, unsigned char *table);
void decode_start_pm2 P_((void));
unsigned short decode_c_pm2 P_((void));
unsigned short decode_p_pm2 P_((void));
+/* pm2tree.c */
+void maketree1 P_((void));
+void maketree2 P_((int tree2bound));
+int tree1_get P_((void));
+int tree2_get P_((void));
+/* pm2hist.c */
+void hist_init P_((void));
+unsigned char hist_lookup P_((int n));
+void hist_update P_((unsigned char data));
/* util.c */
#if !HAVE_MEMMOVE