source: indexers/trunk/mg/src/images/utils.h@ 15660

Last change on this file since 15660 was 15660, checked in by mdewsnip, 16 years ago

Various fixes to get MG to compile with Microsoft Visual Studio 2005.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1/**************************************************************************
2 *
3 * utils.h -- Functions which are common utilities for the image programs
4 * Copyright (C) 1994 Stuart Inglis
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * $Id: utils.h 15660 2008-05-22 23:04:31Z mdewsnip $
21 *
22 **************************************************************************/
23
24#ifndef __UTILS_H
25#define __UTILS_H
26
27#include "sysfuncs.h"
28
29extern int V;
30
31#define DEBUG
32
33#ifndef min
34#define min(a,b) ((a)<(b) ? (a) : (b))
35#endif
36#ifndef max
37#define max(a,b) ((a)>(b) ? (a) : (b))
38#endif
39
40#define GEN_MAGIC(a,b,c,d) ((unsigned long)(((a)<<24) + ((b)<<16) + \
41 ((c)<<8) + (d)))
42
43/* --- MG magic file codes [TS:Aug/95] --- */
44#define MAGIC_FELICS GEN_MAGIC('M','G','F','X')
45#define MAGIC_BILEVEL GEN_MAGIC('M','G','B','I')
46#define MAGIC_TIC GEN_MAGIC('M','G','T','C')
47#define IS_MAGIC(a) ((((u_long)(a)) & 0xffff0000) == MAGIC_XXXX)
48/* --------------------------------------- */
49
50#define MAGIC_P1 0x5031 /* P1 - pbm */
51#define MAGIC_P2 0x5032 /* P2 - pgm */
52#define MAGIC_P3 0x5033 /* P3 - ppm */
53#define MAGIC_P4 0x5034 /* P4 - rawbits pbm */
54#define MAGIC_P5 0x5035 /* P5 - rawbits pgm */
55#define MAGIC_P6 0x5036 /* P6 - rawbits ppm */
56
57int isEOF (FILE * fp);
58int getmagicno_byte (FILE * fp);
59int getmagicno_short (FILE * fp);
60int getmagicno_short_pop (FILE * fp);
61int getmagicno_long (FILE * fp);
62
63
64
65void error_msg (char *prog, char *message, char *extra);
66void warn (char *prog, char *message, char *extra);
67
68void readline (char str[], FILE * fp);
69
70void magic_write (FILE * fp, u_long magic_num);
71void magic_check (FILE * fp, u_long magic_num);
72u_long magic_read (FILE * fp);
73/* kerry's code */
74
75int getint (FILE * fp);
76unsigned int gethint (FILE * fp);
77int isinteger (char s[]);
78
79#endif
Note: See TracBrowser for help on using the repository browser.