xref: /aosp_15_r20/external/giflib/getarg.h (revision 324bb76b8d05e2a05aa88511fff61cf3f9ca5892)
1 /***************************************************************************
2 
3 getarg.h - Support routines for the giflib utilities
4 
5 SPDX-License-Identifier: MIT
6 
7  **************************************************************************/
8 
9 #ifndef _GETARG_H
10 #define _GETARG_H
11 
12 #include "gif_lib.h"
13 #include <stdbool.h>
14 
15 #define VERSION_COOKIE " Version %d.%d, "
16 
17 /***************************************************************************
18    Error numbers as returned by GAGetArg routine:
19 ***************************************************************************/
20 #define CMD_ERR_NotAnOpt 1  /* None Option found. */
21 #define CMD_ERR_NoSuchOpt 2 /* Undefined Option Found. */
22 #define CMD_ERR_WildEmpty 3 /* Empty input for !*? seq. */
23 #define CMD_ERR_NumRead 4   /* Failed on reading number. */
24 #define CMD_ERR_AllSatis 5  /* Fail to satisfy (must-'!') option. */
25 
26 bool GAGetArgs(int argc, char **argv, char *CtrlStr, ...);
27 void GAPrintErrMsg(int Error);
28 void GAPrintHowTo(char *CtrlStr);
29 
30 /******************************************************************************
31  From qprintf.c
32 ******************************************************************************/
33 extern void GifQprintf(char *Format, ...);
34 extern void PrintGifError(int ErrorCode);
35 
36 /******************************************************************************
37  Color table quantization
38 ******************************************************************************/
39 int GifQuantizeBuffer(unsigned int Width, unsigned int Height,
40                       int *ColorMapSize, GifByteType *RedInput,
41                       GifByteType *GreenInput, GifByteType *BlueInput,
42                       GifByteType *OutputBuffer, GifColorType *OutputColorMap);
43 
44 /* These used to live in the library header */
45 #define GIF_MESSAGE(Msg) fprintf(stderr, "\n%s: %s\n", PROGRAM_NAME, Msg)
46 #define GIF_EXIT(Msg)                                                          \
47 	{                                                                      \
48 		GIF_MESSAGE(Msg);                                              \
49 		exit(-3);                                                      \
50 	}
51 
52 #endif /* _GETARG_H */
53 
54 /* end */
55