-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtreaty.h
103 lines (80 loc) · 3 KB
/
treaty.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/* treaty.h Header file for Treaty of Babel compliant format modules
* By L. Ross Raszewski
* Version 0.7
*
* This file is public domain, but please note that derived versions
* may not not be compliant with the Treaty of Babel.
*
* It would be wise for derived works to change the value of
* TREATY_COMPLIANCE to reflect deviations
*/
#ifndef TREATY_H
#define TREATY_H
#define TREATY_COMPLIANCE "Treaty of Babel revision 12"
#define TREATY_VERSION "r12"
/* return codes */
#define NO_REPLY_RV 0
#define INVALID_STORY_FILE_RV -1
#define UNAVAILABLE_RV -2
#define INVALID_USAGE_RV -3
#define INCOMPLETE_REPLY_RV -4
#define VALID_STORY_FILE_RV 1
#define PNG_COVER_FORMAT 1
#define JPEG_COVER_FORMAT 2
/* Treaty bitmasks. These are not required by the treaty, but are here
as a convenience.
*/
#define TREATY_SELECTOR_INPUT 0x100
#define TREATY_SELECTOR_OUTPUT 0x200
#define TREATY_SELECTOR_NUMBER 0xFF
#define TREATY_CONTAINER_SELECTOR 0x400
/* Treaty selectors */
#define GET_HOME_PAGE_SEL 0x201
#define GET_FORMAT_NAME_SEL 0x202
#define GET_FILE_EXTENSIONS_SEL 0x203
#define CLAIM_STORY_FILE_SEL 0x104
#define GET_STORY_FILE_METADATA_EXTENT_SEL 0x105
#define GET_STORY_FILE_COVER_EXTENT_SEL 0x106
#define GET_STORY_FILE_COVER_FORMAT_SEL 0x107
#define GET_STORY_FILE_IFID_SEL 0x308
#define GET_STORY_FILE_METADATA_SEL 0x309
#define GET_STORY_FILE_COVER_SEL 0x30A
#define GET_STORY_FILE_EXTENSION_SEL 0x30B
/* Container selectors */
#define CONTAINER_GET_STORY_FORMAT_SEL 0x710
#define CONTAINER_GET_STORY_EXTENT_SEL 0x511
#define CONTAINER_GET_STORY_FILE_SEL 0x711
/* Other magic size limits */
#define TREATY_MINIMUM_EXTENT 512
#include <limits.h>
/* 32-bit integer types */
#ifndef VAX
#if SCHAR_MAX >= 0x7FFFFFFFL && SCHAR_MIN <= -0x7FFFFFFFL
typedef signed char int32;
typedef unsigned char uint32;
#elif SHRT_MAX >= 0x7FFFFFFFL && SHRT_MIN <= -0x7FFFFFFFL
typedef signed short int int32;
typedef unsigned short int uint32;
#elif INT_MAX >= 0x7FFFFFFFL && INT_MIN <= -0x7FFFFFFFL
typedef signed int int32;
typedef unsigned int uint32;
#elif LONG_MAX >= 0x7FFFFFFFL && LONG_MIN <= -0x7FFFFFFFL
typedef signed long int int32;
typedef unsigned long int uint32;
#else
#error No type large enough to support 32-bit integers.
#endif
#else
/* VAX C does not provide these limit constants, contrary to ANSI */
typedef int int32;
typedef unsigned int uint32;
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Pointer to treaty function. Treaty functions must follow this prototype */
typedef int32 (*TREATY)(int32 selector, void *, int32, void *, int32);
#ifdef __cplusplus
}
#endif
#endif