about summary refs log tree commit diff
path: root/urt/rle_put.h
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-08-19 03:12:28 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2006-08-19 03:12:28 +0000
commit1fd361a1ea06e44286c213ca1f814f49306fdc43 (patch)
tree64c8c96cf54d8718847339a403e5e67b922e8c3f /urt/rle_put.h
downloadnetpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.gz
netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.tar.xz
netpbm-mirror-1fd361a1ea06e44286c213ca1f814f49306fdc43.zip
Create Subversion repository
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'urt/rle_put.h')
-rw-r--r--urt/rle_put.h104
1 files changed, 104 insertions, 0 deletions
diff --git a/urt/rle_put.h b/urt/rle_put.h
new file mode 100644
index 00000000..d611b438
--- /dev/null
+++ b/urt/rle_put.h
@@ -0,0 +1,104 @@
+/*
+ * This software is copyrighted as noted below.  It may be freely copied,
+ * modified, and redistributed, provided that the copyright notice is 
+ * preserved on all copies.
+ * 
+ * There is no warranty or other guarantee of fitness for this software,
+ * it is provided solely "as is".  Bug reports or fixes may be sent
+ * to the author, who may or may not act on them as he desires.
+ *
+ * You may not include this software in a program or other software product
+ * without supplying the source, or without informing the end-user that the 
+ * source is available for no extra charge.
+ *
+ * If you modify this software, you should include a notice giving the
+ * name of the person performing the modification, the date of modification,
+ * and the reason for such modification.
+ */
+/* 
+ * rle_put.h - Definitions and a few global variables for rle_putrow/putraw.
+ * 
+ * Author:	Spencer W. Thomas
+ * 		Computer Science Dept.
+ * 		University of Utah
+ * Date:	Mon Aug  9 1982
+ * Copyright (c) 1982 Spencer W. Thomas
+ * 
+ * $Id: rle_put.h,v 3.0.1.2 1992/02/27 21:14:35 spencer Exp $
+ */
+
+#include "rle.h"
+
+/* ****************************************************************
+ * Dispatch table for different output types.
+ */
+#ifdef __cplusplus        /* Cfront 2.0  or g++ */
+#ifndef c_plusplus
+#define c_plusplus        
+#endif
+extern "C" {
+#endif
+
+
+#ifdef c_plusplus
+#define ARB_ARGS ...
+#else
+#define ARB_ARGS
+#endif
+
+typedef int rle_fn( ARB_ARGS );
+
+struct rle_dispatch_tab {
+    CONST_DECL char   *magic;   /* magic type flags */
+    void (*setup)(rle_hdr * the_hdr);          /* startup function */
+    void (*skipBlankLines)(int nblank, rle_hdr * the_hdr);
+    void(*setColor)(int c, rle_hdr * the_hdr);
+    void(*skipPixels)(int nskip, int last, int wasrun, rle_hdr * the_hdr);
+    void(*newScanLine)(int flag, rle_hdr * the_hdr);
+    void(*putdat)(rle_pixel * buf, int n, rle_hdr * the_hdr);
+        /* put a set of differing pixels */
+    void(*putrn)(int color, int n, int last, rle_hdr * the_hdr);
+        /* put a run all the same */
+    void (*blockHook)(rle_hdr * the_hdr);
+        /* hook called at start of new output block */
+    void(*putEof)(rle_hdr * the_hdr);     /* write EOF marker (if possible) */
+};
+
+extern struct rle_dispatch_tab rle_DTable[];
+
+/* 
+ * These definitions presume the existence of a variable called
+ * "fileptr", declared "long * fileptr".  *fileptr should be
+ * initialized to 0 before calling Setup().
+ * A pointer "the_hdr" declared "rle_hdr * the_hdr" is also
+ * presumed to exist.
+ */
+#define	    rle_magic		(rle_DTable[(int)the_hdr->dispatch].magic)
+#define	    Setup()		(*rle_DTable[(int)the_hdr->dispatch].setup)(the_hdr)
+#define	    SkipBlankLines(n)	(*rle_DTable[(int)the_hdr->dispatch].skipBlankLines)(n, the_hdr)
+#define	    SetColor(c)		(*rle_DTable[(int)the_hdr->dispatch].setColor)(c, the_hdr)
+#define	    SkipPixels(n, l, r)	(*rle_DTable[(int)the_hdr->dispatch].skipPixels)(n,l,r, the_hdr)
+#define	    NewScanLine(flag)	(*rle_DTable[(int)the_hdr->dispatch].newScanLine)(flag, the_hdr)
+#define	    putdata(buf, len)	(*rle_DTable[(int)the_hdr->dispatch].putdat)(buf, len, the_hdr)
+#define	    putrun(val, len, f)	(*rle_DTable[(int)the_hdr->dispatch].putrn)(val,len,f, the_hdr)
+#define	    BlockHook()		(*rle_DTable[(int)the_hdr->dispatch].blockHook)(the_hdr)
+#define	    PutEof()		(*rle_DTable[(int)the_hdr->dispatch].putEof)(the_hdr)
+
+void
+DefaultBlockHook(rle_hdr * the_hdr);
+/* 
+ * States for run detection
+ */
+#define	DATA	0
+#define	RUN1	1
+#define RUN2	2
+#define	RUN3	3
+#define RUN4	4
+#define RUN5	5
+#define RUN6	6
+#define RUN7	7
+#define	INRUN	-1
+
+#ifdef __cplusplus
+}
+#endif