main.c
1.5 KB
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
#include <stdio.h>
#include "tok.h"
int tok_trace;
int trace_pics;
int atoi( char * );
int tok_open_stream(char *);
int tok_process_next_page(int, int);
void tok_close_stream(int);
int xtern_dct_flag;
int xtern_all_flag;
int xtern_mv_flag;
int xtern_iq_flag;
int xtern_mpeg_flag;
#define XT_MC_FLAG (1)
#define XT_ALL_FLAG (2)
#define XT_DCT_FLAG (4)
#define XT_IQ_FLAG (8)
#define XT_MPEG_FLAG (16)
#define TRACE_FLAG (32)
#define TRACE_STDERR (64)
#define TRACE_PICS (128)
int
main(int argc, char **argv)
{
int stream;
int n, ntot;
int tfs;
xtern_dct_flag = 0;
xtern_all_flag = 0;
xtern_mv_flag = 0;
xtern_iq_flag = 0;
xtern_mpeg_flag = 0;
ntot = 0;
tok_trace = 0;
trace_pics = 0;
if( argc > 1 )
stream = tok_open_stream( argv[1] );
else
stream = tok_open_stream( "tokens.out" );
tok_trace = 0;
if( argc > 2 ) {
tfs = atoi( argv[2] );
if( tfs & TRACE_FLAG )
tok_trace = 1;
/*
if( tfs & TRACE_STDERR )
tok_set_trace_file( stderr );
else
tok_set_trace_file( stdout );
*/
xtern_dct_flag = (tfs & XT_DCT_FLAG);
xtern_all_flag = (tfs & XT_ALL_FLAG);
xtern_mv_flag = (tfs & XT_MC_FLAG);
xtern_iq_flag = (tfs & XT_IQ_FLAG);
xtern_mpeg_flag = (tfs & XT_MPEG_FLAG);
trace_pics = (tfs & TRACE_PICS);
};
while( (n=tok_process_next_page( stream, 10000 )) >= 0 ) {
ntot += n;
fprintf(stderr,"n = %d ", n);
};
tok_close_stream( stream );
fprintf(stderr,"Ntot = %d\n", ntot);
return(0);
}