rle_put.h

Go to the documentation of this file.
00001 /*
00002  * This software is copyrighted as noted below.  It may be freely copied,
00003  * modified, and redistributed, provided that the copyright notice is 
00004  * preserved on all copies.
00005  * 
00006  * There is no warranty or other guarantee of fitness for this software,
00007  * it is provided solely "as is".  Bug reports or fixes may be sent
00008  * to the author, who may or may not act on them as he desires.
00009  *
00010  * You may not include this software in a program or other software product
00011  * without supplying the source, or without informing the end-user that the 
00012  * source is available for no extra charge.
00013  *
00014  * If you modify this software, you should include a notice giving the
00015  * name of the person performing the modification, the date of modification,
00016  * and the reason for such modification.
00017  */
00018 /** @addtogroup utahrle */
00019 /*@{*/
00020 /* 
00021  * rle_put.h - Definitions and a few global variables for rle_putrow/putraw.
00022  * 
00023  * Author:      Spencer W. Thomas
00024  *              Computer Science Dept.
00025  *              University of Utah
00026  * Date:        Mon Aug  9 1982
00027  * Copyright (c) 1982 Spencer W. Thomas
00028  * 
00029  * $Id: rle_put.h,v 14.3 2006/09/18 05:24:07 lbutler Exp $
00030  */
00031 
00032 #include "rle.h"
00033 
00034 /* ****************************************************************
00035  * Dispatch table for different output types.
00036  */
00037 #ifdef __cplusplus        /* Cfront 2.0  or g++ */
00038 #ifndef c_plusplus
00039 #define c_plusplus        
00040 #endif
00041 extern "C" {
00042 #endif
00043 
00044 
00045 #ifdef c_plusplus
00046 #define ARB_ARGS ...
00047 #else
00048 #define ARB_ARGS
00049 #endif
00050 
00051 typedef int rle_fn( ARB_ARGS );
00052 
00053 struct rle_dispatch_tab {
00054     CONST_DECL char   *magic;   /* magic type flags */
00055     rle_fn *setup,                      /* startup function */
00056            *skipBlankLines,
00057            *setColor,
00058            *skipPixels,
00059            *newScanLine,
00060            *putdat,                     /* put a set of differing pixels */
00061            *putrn,                      /* put a run all the same */
00062            *blockHook,                  /* hook called at start of new */
00063                                         /* output block */
00064            *putEof;             /* write EOF marker (if possible) */
00065 };
00066 
00067 extern struct rle_dispatch_tab rle_DTable[];
00068 
00069 /* 
00070  * These definitions presume the existence of a variable called
00071  * "fileptr", declared "long * fileptr".  *fileptr should be
00072  * initialized to 0 before calling Setup().
00073  * A pointer "the_hdr" declared "rle_hdr * the_hdr" is also
00074  * presumed to exist.
00075  */
00076 #define     rle_magic           (rle_DTable[(int)the_hdr->dispatch].magic)
00077 #define     Setup()             (*rle_DTable[(int)the_hdr->dispatch].setup)(the_hdr)
00078 #define     SkipBlankLines(n)   (*rle_DTable[(int)the_hdr->dispatch].skipBlankLines)(n, the_hdr)
00079 #define     SetColor(c)         (*rle_DTable[(int)the_hdr->dispatch].setColor)(c, the_hdr)
00080 #define     SkipPixels(n, l, r) (*rle_DTable[(int)the_hdr->dispatch].skipPixels)(n,l,r, the_hdr)
00081 #define     NewScanLine(flag)   (*rle_DTable[(int)the_hdr->dispatch].newScanLine)(flag, the_hdr)
00082 #define     putdata(buf, len)   (*rle_DTable[(int)the_hdr->dispatch].putdat)(buf, len, the_hdr)
00083 #define     putrun(val, len, f) (*rle_DTable[(int)the_hdr->dispatch].putrn)(val,len,f, the_hdr)
00084 #define     BlockHook()         (*rle_DTable[(int)the_hdr->dispatch].blockHook)(the_hdr)
00085 #define     PutEof()            (*rle_DTable[(int)the_hdr->dispatch].putEof)(the_hdr)
00086 
00087 /* 
00088  * States for run detection
00089  */
00090 #define DATA    0
00091 #define RUN1    1
00092 #define RUN2    2
00093 #define RUN3    3
00094 #define RUN4    4
00095 #define RUN5    5
00096 #define RUN6    6
00097 #define RUN7    7
00098 #define INRUN   -1
00099 
00100 #ifdef __cplusplus
00101 }
00102 #endif
00103 /*@}*/

Generated on Mon Sep 18 01:24:42 2006 for BRL-CAD by  doxygen 1.4.6