summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.75.0/src/uncrustify.h
blob: 1f85b9935487f9d8c03a6f15ee2f9845598fae4d (plain)
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
/**
 * @file uncrustify.h
 * prototypes for uncrustify.c
 *
 * @author  Ben Gardner
 * @license GPL v2+
 */

#ifndef UNCRUSTIFY_H_INCLUDED
#define UNCRUSTIFY_H_INCLUDED

#include "uncrustify_types.h"

#include <stdio.h>

int load_header_files(void);


void uncrustify_file(const file_mem &fm, FILE *pfout, const char *parsed_file, const char *dump_filename, bool defer_uncrustify_end = false);


void uncrustify_end();


const char *get_token_name(E_Token token);


/**
 * Gets the tag text for a language
 *
 * @param lang  The LANG_xxx enum
 *
 * @return A string
 */
const char *language_name_from_flags(size_t lang);


/**
 * Grab the token id for the text.
 *
 * @return token, will be CT_NONE on failure to match
 */
E_Token find_token_name(const char *text);

std::string pcf_flags_str(pcf_flags_t flags);


void log_pcf_flags(log_sev_t sev, pcf_flags_t flags);


/**
 * Replace the brain-dead and non-portable basename().
 * Returns a pointer to the character after the last '/'.
 * The returned value always points into path, unless path is nullptr.
 *
 * Input            Returns
 * nullptr       => ""
 * "/some/path/" => ""
 * "/some/path"  => "path"
 * "afile"       => "afile"
 *
 * @param path  The path to look at
 *
 * @return Pointer to the character after the last path separator
 */
const char *path_basename(const char *path);


/**
 * Returns the length of the directory part of the filename.
 *
 * @param filename  filename including full path
 *
 * @return character size of path
 */
int path_dirname_len(const char *filename);


void usage(const char *argv0);


void usage_error(const char *msg = nullptr);


/**
 * Set idx = 0 before the first call.
 * Done when returns nullptr
 */
const char *get_file_extension(int &idx);


//! Prints custom file extensions to the file
void print_extensions(FILE *pfile);


const char *extension_add(const char *ext_text, const char *lang_text);


#endif /* UNCRUSTIFY_H_INCLUDED */