main.c 1.5 KB
#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);
}