summaryrefslogtreecommitdiff
blob: 880dfa059545a904b7d30849fb90b7afd28cb862 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
diff -Nru tic98/Makefile tic98.gentoo/Makefile
--- tic98/Makefile	1999-06-22 05:00:58.000000000 -0400
+++ tic98.gentoo/Makefile	2002-10-19 18:20:55.000000000 -0400
@@ -1,4 +1,4 @@
-BIN=/home/singlis/linux/bin
+BIN=/usr/bin
 IMAGES=/home/ml/singlis
 LIBTIC= 
 LIBS=   -lm #-L/home/singlis/linux/lib -lccmalloc -ldl
@@ -180,4 +180,4 @@
 	 boundary.o getopt.o windowing.o
 	$(CC) -o $@ $^ $(LIBS)
 
- 
\ No newline at end of file
+ 
diff -Nru tic98/arithcode.c tic98.gentoo/arithcode.c
--- tic98/arithcode.c	1999-06-21 21:48:40.000000000 -0400
+++ tic98.gentoo/arithcode.c	2002-10-19 18:19:20.000000000 -0400
@@ -610,7 +610,7 @@
     bits_to_go = 0;
 }
 
-#ifdef 0
+#ifdef none
 void
 arith_encode( unsigned int lbnd, unsigned int hbnd, unsigned int totl )
 /* Arithmetically encode the range. */
@@ -645,7 +645,7 @@
 }
 
 
-#ifdef 0
+#ifdef none
 void arith_decode( unsigned int lbnd, unsigned int hbnd, unsigned int totl )
 /* Arithmetically decode the range. */
 {
@@ -726,7 +726,7 @@
 
 
 
-#ifdef 0
+#ifdef none
 
 void 
 EncodeGammaSigned (int snum, int *pos, int *neg)
diff -Nru tic98/b_gamma.c tic98.gentoo/b_gamma.c
--- tic98/b_gamma.c	1999-06-21 21:48:41.000000000 -0400
+++ tic98.gentoo/b_gamma.c	2002-10-19 18:18:43.000000000 -0400
@@ -187,7 +187,7 @@
     }
 }
 
-#ifdef 0
+#ifdef none
 void 
 b_gamma_encode_64(unsigned long num)
 {
diff -Nru tic98/docstrum.c tic98.gentoo/docstrum.c
--- tic98/docstrum.c	1999-07-01 15:58:37.000000000 -0400
+++ tic98.gentoo/docstrum.c	2002-10-19 18:19:39.000000000 -0400
@@ -672,7 +672,7 @@
     calc_docstrum_spacing(list,neighs,0,&within,&between);
 
     prune_neighbours_distance(neighs,len, 3*between);
-#ifdef 0
+#ifdef none
     prune_neighbours_angle_distance(neighs,len, 0,30, 6*within/*MIN(6*within,sqrt(2.0)*between)*/);
 #endif
 
diff -Nru tic98/ppmd_model.c tic98.gentoo/ppmd_model.c
--- tic98/ppmd_model.c	1999-06-21 21:48:42.000000000 -0400
+++ tic98.gentoo/ppmd_model.c	2002-10-19 18:20:33.000000000 -0400
@@ -496,7 +496,7 @@
 	arithmetic_encode( lbnd, hbnd, totl );
 }
 
-#ifdef 0
+#ifdef none
 unsigned int
 arith_decode_target (unsigned int totl)
 /* Arithmetically decodes the target. */
diff -Nru tic98.orig/page_features.c tic98/page_features.c
--- tic98.orig/page_features.c	1999-06-22 03:48:42.000000000 +0200
+++ tic98/page_features.c	2005-08-02 19:47:09.485681960 +0200
@@ -37,18 +37,17 @@
 void
 dump_header()
 {
-  fprintf(stdout,"@arff 3
-@relation features
-@attribute 'Number' real
-@attribute 'Area' real
-@attribute 'Avg_area' real
-@attribute 'Density' real
-@attribute 'Aspect' real
-@attribute 'Holes' real
-@attribute 'Edges' real
-@attribute 'class' string range ( {?} )
-@data
-");
+  fprintf(stdout,"@arff 3"
+"@relation features"
+"@attribute 'Number' real"
+"@attribute 'Area' real"
+"@attribute 'Avg_area' real"
+"@attribute 'Density' real"
+"@attribute 'Aspect' real"
+"@attribute 'Holes' real"
+"@attribute 'Edges' real"
+"@attribute 'class' string range ( {?} )"
+"@data");
 
 
 }
diff -ru tic98/main_tic.c tic98-new/main_tic.c
--- tic98/main_tic.c	Thu Jul  1 21:02:56 1999
+++ tic98-new/main_tic.c	Fri Mar 16 11:43:56 2001
@@ -11,6 +11,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <errno.h>
 
 #include "arithcode.h"
 #include "globals.h"
@@ -96,8 +97,10 @@
   marklistptr list=NULL,list2=NULL;
   marktype copy;
 
-  if(marktype_readnamed(fn, image)!=0)
+  if(marktype_readnamed(fn, image)!=0) {
+    fprintf(stderr, "imagefn_to_list(): bad input file %s\n", fn);
     return NULL;
+  }
 
   *w=image->w;
   *h=image->h;
@@ -495,7 +498,10 @@
 
     TimerStart(1);
 
-    freopen(outfilename[0],"wb",stdout);
+    if (! freopen(outfilename[0],"wb",stdout)) {
+	 fprintf(stderr, "failed to open %s for writing: %s\n",
+		 outfilename[0], strerror(errno));
+    }
 
     tic98_init(&t);
     tic98_start_encoding();
@@ -503,8 +509,11 @@
     for(i=0;i<num_in;i++){
       int w,h,xx,yy,ok=0;
       marktype image;
-      list=imagefn_to_list(&image,infilename[i], &w, &h);
-      
+      if (! (list=imagefn_to_list(&image,infilename[i], &w, &h))) {
+	   fprintf(stderr, "cannot read file %s\n", infilename[i]);
+	   exit(1);
+      }
+
       tic98_num_encode(&t,NEW_PAGE);
 
       for(xx=0;xx<image.w;xx++)
@@ -560,7 +569,10 @@
     newoutname=(char*)malloc(sizeof(char)*(strlen(outfilename[0])+10));
     assert(newoutname);
 
-    freopen(infilename[0],"rb",stdin);
+    if (! freopen(infilename[0],"rb",stdin)) {
+	 fprintf(stderr, "failed to open %s for reading: %s\n",
+		 infilename[0], strerror(errno));
+    }
 
     tic98_init(&t);
     tic98_start_decoding();
diff -ru tic98/marklist.c tic98-new/marklist.c
--- tic98/marklist.c	Thu Jul  1 21:56:19 1999
+++ tic98-new/marklist.c	Fri Mar 16 11:44:20 2001
@@ -94,11 +94,11 @@
   magic = magic_popnamed (fn, &err) >> 16;	/* only interested in first 2 bytes */
 
   if (err != 0) {
-    return 1;			/* failure */
     fprintf (stderr, "error - can't open file '%s'\n", fn);
-    return 1;
+    return 1;			/* failure */
   }
   if (!((magic == MAGIC_P1) || (magic == MAGIC_P4))) {
+    fprintf (stderr, "bad magic in file '%s'\n", fn);
     return 1;
   }
   if (fn2) {
diff -ru tic98/utils.c tic98-new/utils.c
--- tic98/utils.c	Tue Jun 22 02:48:43 1999
+++ tic98-new/utils.c	Fri Mar 16 11:23:57 2001
@@ -117,7 +117,7 @@
     }
     else{
 	*err=1;
-/*	error("magic_popnamed","can't open file",fn);*/
+	error("magic_popnamed","can't open file",fn);
 	return 0;
     }
 }