forked from niftich/magenta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheader_generator.h
44 lines (36 loc) · 1.45 KB
/
header_generator.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
// Copyright 2017 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#pragma once
#include <map>
#include <string>
#include <vector>
#include "generator.h"
/* Generates header files. */
class HeaderGenerator : public Generator {
public:
// A prefix on the syscall name, and a predicate that returns
// true if it should be omitted from the header.
using name_prefix_map =
std::vector<std::pair<std::string, bool (*)(const Syscall&)>>;
HeaderGenerator(const std::string& function_prefix,
const name_prefix_map& name_prefixes,
const std::string& no_args_type,
bool allow_pointer_wrapping,
const std::map<std::string, std::string>& attributes)
: function_prefix_(function_prefix),
name_prefixes_(name_prefixes),
no_args_type_(no_args_type),
attributes_(attributes),
allow_pointer_wrapping_(allow_pointer_wrapping) {}
bool syscall(std::ofstream& os, const Syscall& sc) override;
private:
const std::string function_prefix_;
const name_prefix_map name_prefixes_;
const std::string no_args_type_;
const std::map<std::string, std::string> attributes_;
const bool allow_pointer_wrapping_;
};
HeaderGenerator kernel_header_generator();
HeaderGenerator user_header_generator();
HeaderGenerator vdso_header_generator();