1 /* Catacomb Armageddon Source Code
\r
2 * Copyright (C) 1993-2014 Flat Rock Software
\r
4 * This program is free software; you can redistribute it and/or modify
\r
5 * it under the terms of the GNU General Public License as published by
\r
6 * the Free Software Foundation; either version 2 of the License, or
\r
7 * (at your option) any later version.
\r
9 * This program is distributed in the hope that it will be useful,
\r
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 * GNU General Public License for more details.
\r
14 * You should have received a copy of the GNU General Public License along
\r
15 * with this program; if not, write to the Free Software Foundation, Inc.,
\r
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\r
32 //----------------------------------------------------------------------------
\r
34 // PTR/PTR COMPRESSION ROUTINES
\r
37 //----------------------------------------------------------------------------
\r
41 //---------------------------------------------------------------------------
\r
42 // WritePtr() -- Outputs data to a particular ptr type
\r
44 // PtrType MUST be of type DEST_TYPE.
\r
46 // NOTE : For PtrTypes DEST_MEM a ZERO (0) is always returned.
\r
48 //---------------------------------------------------------------------------
\r
49 char WritePtr(long outfile, unsigned char data, unsigned PtrType)
\r
53 switch (PtrType & DEST_TYPES)
\r
56 write(*(int far *)outfile,(char *)&data,1);
\r
60 returnval = putc(data, *(FILE **)outfile);
\r
64 printf("WritePtr - unsupported ptr type\n");
\r
69 *((char far *)*(char far **)outfile)++ = data;
\r
78 //---------------------------------------------------------------------------
\r
79 // ReadPtr() -- Reads data from a particular ptr type
\r
81 // PtrType MUST be of type SRC_TYPE.
\r
84 // The char read in or EOF for SRC_FFILE type of reads.
\r
87 //---------------------------------------------------------------------------
\r
88 int ReadPtr(long infile, unsigned PtrType)
\r
92 switch (PtrType & SRC_TYPES)
\r
95 read(*(int far *)infile,(char *)&returnval,1);
\r
99 returnval = getc(*(FILE far **)infile
\r
104 returnval = bio_readch((BufferedIO *)*(void far **)infile);
\r
108 // printf("WritePtr - unsupported ptr type\n");
\r
113 returnval = (unsigned char)*((char far *)*(char far **)infile)++;
\r