Category : Files from Magazines
Archive   : CUJ0894.ZIP
Filename : FFILTER.HPP

 
Output of file : FFILTER.HPP contained in archive : CUJ0894.ZIP
// class FileFilter:
//
// The FileFilter class encapsulates reading an
// input file, filtering its contents through a function,
// and writing the result to an output file. It uses two
// threads of execution, one for reading the file, the other
// for writing the output file.
//
// Author: Michael Kelly
//
// Date: July 26, 1993
//
// Copyright: Copyright (c) 1993 Michael Kelly,
// all rights reserved.
//
#if !defined(FFILTER_HPP)
#define FFILTER_HPP

#if !defined(INCL_DOSPROCESS)
#define INCL_DOSPROCESS
#endif
#if !defined(INCL_DOSSEMAPHORES)
#define INCL_DOSSEMAPHORES
#endif
#if !defined(INCL_DOSQUEUES)
#define INCL_DOSQUEUES
#endif
#include
#include
#include
#include
#include


#define INBUF_SIZE 4096
#define QNAME_LEN 32

struct data_block {
int data_size;
char *block;
};

class FileFilter {
protected:
HEV done_sem;
HQUEUE qhandle;
char qname[ QNAME_LEN ];
ULONG max_sem_wait;

static int count;
int in_line_mode;
int blocks2read;
int blocks2write;
int filter_valid;
data_block* (*filter)( data_block *inblock );

ULONG filter_error;
FILE *rfile;
FILE *wfile;

friend void read_thread( void *filterptr );
friend void write_thread( void *filterptr );
int create_sem();

int create_queue();
data_block *get_queue();
int put_queue( data_block *data );

public:
FileFilter() {}
FileFilter( const char *file2read,
const char *file2write,
data_block* (*filter_func)
( data_block *inblock ) );


~FileFilter();

ULONG error_code() { return filter_error; }
int valid() { return filter_valid; }
APIRET wait4completion( ULONG max_wait );
};


#endif


  3 Responses to “Category : Files from Magazines
Archive   : CUJ0894.ZIP
Filename : FFILTER.HPP

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/