Blame urt/rle_put.h

Packit 78deda
/*
Packit 78deda
 * This software is copyrighted as noted below.  It may be freely copied,
Packit 78deda
 * modified, and redistributed, provided that the copyright notice is 
Packit 78deda
 * preserved on all copies.
Packit 78deda
 * 
Packit 78deda
 * There is no warranty or other guarantee of fitness for this software,
Packit 78deda
 * it is provided solely "as is".  Bug reports or fixes may be sent
Packit 78deda
 * to the author, who may or may not act on them as he desires.
Packit 78deda
 *
Packit 78deda
 * You may not include this software in a program or other software product
Packit 78deda
 * without supplying the source, or without informing the end-user that the 
Packit 78deda
 * source is available for no extra charge.
Packit 78deda
 *
Packit 78deda
 * If you modify this software, you should include a notice giving the
Packit 78deda
 * name of the person performing the modification, the date of modification,
Packit 78deda
 * and the reason for such modification.
Packit 78deda
 */
Packit 78deda
/* 
Packit 78deda
 * rle_put.h - Definitions and a few global variables for rle_putrow/putraw.
Packit 78deda
 * 
Packit 78deda
 * Author:	Spencer W. Thomas
Packit 78deda
 * 		Computer Science Dept.
Packit 78deda
 * 		University of Utah
Packit 78deda
 * Date:	Mon Aug  9 1982
Packit 78deda
 * Copyright (c) 1982 Spencer W. Thomas
Packit 78deda
 * 
Packit 78deda
 * $Id: rle_put.h,v 3.0.1.2 1992/02/27 21:14:35 spencer Exp $
Packit 78deda
 */
Packit 78deda
Packit 78deda
#include "rle.h"
Packit 78deda
#include "rle_config.h"
Packit 78deda
Packit 78deda
/* ****************************************************************
Packit 78deda
 * Dispatch table for different output types.
Packit 78deda
 */
Packit 78deda
#ifdef __cplusplus        /* Cfront 2.0  or g++ */
Packit 78deda
#ifndef c_plusplus
Packit 78deda
#define c_plusplus        
Packit 78deda
#endif
Packit 78deda
extern "C" {
Packit 78deda
#endif
Packit 78deda
Packit 78deda
Packit 78deda
#ifdef c_plusplus
Packit 78deda
#define ARB_ARGS ...
Packit 78deda
#else
Packit 78deda
#define ARB_ARGS
Packit 78deda
#endif
Packit 78deda
Packit 78deda
typedef int rle_fn( ARB_ARGS );
Packit 78deda
Packit 78deda
struct rle_dispatch_tab {
Packit 78deda
    CONST_DECL char   *magic;   /* magic type flags */
Packit 78deda
    void (*setup)(rle_hdr * the_hdr);          /* startup function */
Packit 78deda
    void (*skipBlankLines)(int nblank, rle_hdr * the_hdr);
Packit 78deda
    void(*setColor)(int c, rle_hdr * the_hdr);
Packit 78deda
    void(*skipPixels)(int nskip, int last, int wasrun, rle_hdr * the_hdr);
Packit 78deda
    void(*newScanLine)(int flag, rle_hdr * the_hdr);
Packit 78deda
    void(*putdat)(rle_pixel * buf, int n, rle_hdr * the_hdr);
Packit 78deda
        /* put a set of differing pixels */
Packit 78deda
    void(*putrn)(int color, int n, int last, rle_hdr * the_hdr);
Packit 78deda
        /* put a run all the same */
Packit 78deda
    void (*blockHook)(rle_hdr * the_hdr);
Packit 78deda
        /* hook called at start of new output block */
Packit 78deda
    void(*putEof)(rle_hdr * the_hdr);     /* write EOF marker (if possible) */
Packit 78deda
};
Packit 78deda
Packit 78deda
extern struct rle_dispatch_tab rle_DTable[];
Packit 78deda
Packit 78deda
/* 
Packit 78deda
 * These definitions presume the existence of a variable called
Packit 78deda
 * "fileptr", declared "long * fileptr".  *fileptr should be
Packit 78deda
 * initialized to 0 before calling Setup().
Packit 78deda
 * A pointer "the_hdr" declared "rle_hdr * the_hdr" is also
Packit 78deda
 * presumed to exist.
Packit 78deda
 */
Packit 78deda
#define	    rle_magic		(rle_DTable[(int)the_hdr->dispatch].magic)
Packit 78deda
#define	    Setup()		(*rle_DTable[(int)the_hdr->dispatch].setup)(the_hdr)
Packit 78deda
#define	    SkipBlankLines(n)	(*rle_DTable[(int)the_hdr->dispatch].skipBlankLines)(n, the_hdr)
Packit 78deda
#define	    SetColor(c)		(*rle_DTable[(int)the_hdr->dispatch].setColor)(c, the_hdr)
Packit 78deda
#define	    SkipPixels(n, l, r)	(*rle_DTable[(int)the_hdr->dispatch].skipPixels)(n,l,r, the_hdr)
Packit 78deda
#define	    NewScanLine(flag)	(*rle_DTable[(int)the_hdr->dispatch].newScanLine)(flag, the_hdr)
Packit 78deda
#define	    putdata(buf, len)	(*rle_DTable[(int)the_hdr->dispatch].putdat)(buf, len, the_hdr)
Packit 78deda
#define	    putrun(val, len, f)	(*rle_DTable[(int)the_hdr->dispatch].putrn)(val,len,f, the_hdr)
Packit 78deda
#define	    BlockHook()		(*rle_DTable[(int)the_hdr->dispatch].blockHook)(the_hdr)
Packit 78deda
#define	    PutEof()		(*rle_DTable[(int)the_hdr->dispatch].putEof)(the_hdr)
Packit 78deda
Packit 78deda
void
Packit 78deda
DefaultBlockHook(rle_hdr * the_hdr);
Packit 78deda
/* 
Packit 78deda
 * States for run detection
Packit 78deda
 */
Packit 78deda
#define	DATA	0
Packit 78deda
#define	RUN1	1
Packit 78deda
#define RUN2	2
Packit 78deda
#define	RUN3	3
Packit 78deda
#define RUN4	4
Packit 78deda
#define RUN5	5
Packit 78deda
#define RUN6	6
Packit 78deda
#define RUN7	7
Packit 78deda
#define	INRUN	-1
Packit 78deda
Packit 78deda
#ifdef __cplusplus
Packit 78deda
}
Packit 78deda
#endif