-
Notifications
You must be signed in to change notification settings - Fork 3
/
iocccsize.h
78 lines (65 loc) · 1.89 KB
/
iocccsize.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
/*
* iocccsize - IOCCC Source Size Tool
*
* Public Domain 1992, 2022 by Anthony Howe. All rights released.
* With IOCCC minor mods in 2019, 2022 by chongo (Landon Curt Noll) ^oo^
*/
#ifndef __iocccsize_h__
#define __iocccsize_h__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
/* IOCCC tool chain, see https://github.com/ioccc-src/mkiocccentry */
#if defined(MKIOCCCENTRY_USE)
# include "limit_ioccc.h" /* Can override our defines. */
#else
# define DIGRAPHS /* Digraphs count as 1 for Rule 2b.*/
# define TRIGRAPHS /* Trigraphs count as 1 for Rule 2b.*/
#endif
/* Official contest VERSION defined by limit_ioccc.h,
* else the official git repository version tag.
*/
#ifndef VERSION
# define VERSION "unofficial"
#endif
#ifndef WORD_BUFFER_SIZE
# define WORD_BUFFER_SIZE 16
#endif
#ifndef RULE_2A_SIZE
# define RULE_2A_SIZE 4993 /* IOCCC Rule 2a, pre-2024 4096 */
#endif
#ifndef RULE_2B_SIZE
# define RULE_2B_SIZE 2503 /* IOCCC Rule 2b, pre-2024 2053 */
#endif
typedef struct {
unsigned long rule_2a_size;
unsigned long rule_2b_size;
unsigned long keywords; /* keyword count - for -v mode */
unsigned long nul; /* Count NUL bytes seen. */
unsigned long high_bit; /* Count non-ASCII high-bit set bytes. */
unsigned long bad_trigraph; /* Count unknown trigraphs seen. */
unsigned long ungetc_error; /* Count ungetc depth exceeded. */
unsigned long word_overflow; /* Count word buffer overflows. */
} RuleCount;
/**
* Set greater than zero for extra debug output.
*
* 0 no debug
* 1 no debug assigned at this time
* 2 source to standard output, comment & keyword debug to standard error.
* 3 same a 2 with extra character classification debug
*/
extern int rule_count_debug;
/**
* @param fp_in
* File pointer to the C source input.
*
* @return
* Return a RuleCount structure.
*/
extern RuleCount rule_count(FILE *fp_in);
#ifdef __cplusplus
}
#endif
#endif /* __iocccsize_h__ */