Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
rle_put.h
Go to the documentation of this file.
1 /*
2  * This software is copyrighted as noted below. It may be freely copied,
3  * modified, and redistributed, provided that the copyright notice is
4  * preserved on all copies.
5  *
6  * There is no warranty or other guarantee of fitness for this software,
7  * it is provided solely "as is". Bug reports or fixes may be sent
8  * to the author, who may or may not act on them as he desires.
9  *
10  * You may not include this software in a program or other software product
11  * without supplying the source, or without informing the end-user that the
12  * source is available for no extra charge.
13  *
14  * If you modify this software, you should include a notice giving the
15  * name of the person performing the modification, the date of modification,
16  * and the reason for such modification.
17  */
18 /*
19  * rle_put.h - Definitions and a few global variables for rle_putrow/putraw.
20  *
21  * Author: Spencer W. Thomas
22  * Computer Science Dept.
23  * University of Utah
24  * Date: Mon Aug 9 1982
25  * Copyright (c) 1982 Spencer W. Thomas
26  *
27  * $Id: rle_put.h,v 3.0.1.2 1992/02/27 21:14:35 spencer Exp $
28  */
29 
30 #include "rle.h"
31 
32 /* ****************************************************************
33  * Dispatch table for different output types.
34  */
35 #ifdef __cplusplus /* Cfront 2.0 or g++ */
36 #ifndef c_plusplus
37 #define c_plusplus
38 #endif
39 extern "C" {
40 #endif
41 
42 
43 #ifdef c_plusplus
44 #define ARB_ARGS ...
45 #else
46 #define ARB_ARGS
47 #endif
48 
49 typedef int rle_fn( ARB_ARGS );
50 
52  CONST_DECL char *magic; /* magic type flags */
53  rle_fn *setup, /* startup function */
55  *setColor,
56  *skipPixels,
57  *newScanLine,
58  *putdat, /* put a set of differing pixels */
59  *putrn, /* put a run all the same */
60  *blockHook, /* hook called at start of new */
61  /* output block */
62  *putEof; /* write EOF marker (if possible) */
63 };
64 
65 extern struct rle_dispatch_tab rle_DTable[];
66 
67 /*
68  * These definitions presume the existence of a variable called
69  * "fileptr", declared "long * fileptr". *fileptr should be
70  * initialized to 0 before calling Setup().
71  * A pointer "the_hdr" declared "rle_hdr * the_hdr" is also
72  * presumed to exist.
73  */
74 #define rle_magic (rle_DTable[(int)the_hdr->dispatch].magic)
75 #define Setup() (*rle_DTable[(int)the_hdr->dispatch].setup)(the_hdr)
76 #define SkipBlankLines(n) (*rle_DTable[(int)the_hdr->dispatch].skipBlankLines)(n, the_hdr)
77 #define SetColor(c) (*rle_DTable[(int)the_hdr->dispatch].setColor)(c, the_hdr)
78 #define SkipPixels(n, l, r) (*rle_DTable[(int)the_hdr->dispatch].skipPixels)(n,l,r, the_hdr)
79 #define NewScanLine(flag) (*rle_DTable[(int)the_hdr->dispatch].newScanLine)(flag, the_hdr)
80 #define putdata(buf, len) (*rle_DTable[(int)the_hdr->dispatch].putdat)(buf, len, the_hdr)
81 #define putrun(val, len, f) (*rle_DTable[(int)the_hdr->dispatch].putrn)(val,len,f, the_hdr)
82 #define BlockHook() (*rle_DTable[(int)the_hdr->dispatch].blockHook)(the_hdr)
83 #define PutEof() (*rle_DTable[(int)the_hdr->dispatch].putEof)(the_hdr)
84 
85 /*
86  * States for run detection
87  */
88 #define DATA 0
89 #define RUN1 1
90 #define RUN2 2
91 #define RUN3 3
92 #define RUN4 4
93 #define RUN5 5
94 #define RUN6 6
95 #define RUN7 7
96 #define INRUN -1
97 
98 #ifdef __cplusplus
99 }
100 #endif
rle_fn * putEof
Definition: rle_put.h:53
rle_fn * skipBlankLines
Definition: rle_put.h:53
const char * magic
Definition: rle_put.h:52
rle_fn * putdat
Definition: rle_put.h:53
struct rle_dispatch_tab rle_DTable[]
Definition: rle_global.c:49
#define CONST_DECL
Definition: rle_config.h:42
int rle_fn()
Definition: rle_put.h:49
rle_fn * newScanLine
Definition: rle_put.h:53
#define ARB_ARGS
Definition: rle_put.h:46
rle_fn * setup
Definition: rle_put.h:53
rle_fn * setColor
Definition: rle_put.h:53
rle_fn * putrn
Definition: rle_put.h:53
rle_fn * blockHook
Definition: rle_put.h:53
rle_fn * skipPixels
Definition: rle_put.h:53