source: main/tags/2.80/indexers/mg/src/images/utils.h@ 24539

Last change on this file since 24539 was 3745, checked in by mdewsnip, 21 years ago

Addition of MG package for search and retrieval

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 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 3745 2003-02-20 21:20:24Z 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#define min(a,b) ((a)<(b) ? (a) : (b))
34#define max(a,b) ((a)>(b) ? (a) : (b))
35
36#define GEN_MAGIC(a,b,c,d) ((unsigned long)(((a)<<24) + ((b)<<16) + \
37 ((c)<<8) + (d)))
38
39/* --- MG magic file codes [TS:Aug/95] --- */
40#define MAGIC_FELICS GEN_MAGIC('M','G','F','X')
41#define MAGIC_BILEVEL GEN_MAGIC('M','G','B','I')
42#define MAGIC_TIC GEN_MAGIC('M','G','T','C')
43#define IS_MAGIC(a) ((((u_long)(a)) & 0xffff0000) == MAGIC_XXXX)
44/* --------------------------------------- */
45
46#define MAGIC_P1 0x5031 /* P1 - pbm */
47#define MAGIC_P2 0x5032 /* P2 - pgm */
48#define MAGIC_P3 0x5033 /* P3 - ppm */
49#define MAGIC_P4 0x5034 /* P4 - rawbits pbm */
50#define MAGIC_P5 0x5035 /* P5 - rawbits pgm */
51#define MAGIC_P6 0x5036 /* P6 - rawbits ppm */
52
53int isEOF (FILE * fp);
54int getmagicno_byte (FILE * fp);
55int getmagicno_short (FILE * fp);
56int getmagicno_short_pop (FILE * fp);
57int getmagicno_long (FILE * fp);
58
59
60
61void error_msg (char *prog, char *message, char *extra);
62void warn (char *prog, char *message, char *extra);
63
64void readline (char str[], FILE * fp);
65
66void magic_write (FILE * fp, u_long magic_num);
67void magic_check (FILE * fp, u_long magic_num);
68u_long magic_read (FILE * fp);
69/* kerry's code */
70
71int getint (FILE * fp);
72unsigned int gethint (FILE * fp);
73int isinteger (char s[]);
74
75#endif
Note: See TracBrowser for help on using the repository browser.