| 1 |
%YAML 1.2 |
| 2 |
--- | |
| 3 |
/* |
| 4 |
* |
| 5 |
* Copyright 2016 gRPC authors. |
| 6 |
* |
| 7 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 |
* you may not use this file except in compliance with the License. |
| 9 |
* You may obtain a copy of the License at |
| 10 |
* |
| 11 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 12 |
* |
| 13 |
* Unless required by applicable law or agreed to in writing, software |
| 14 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 15 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 |
* See the License for the specific language governing permissions and |
| 17 |
* limitations under the License. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
<% |
| 22 |
def is_platform_header(hdr): |
| 23 |
for platform_identifier in ['_gcc', '_windows', '_pthread', |
| 24 |
'_zookeeper', '_msvc', '_posix']: |
| 25 |
if platform_identifier in hdr: |
| 26 |
return True |
| 27 |
return False |
| 28 |
def is_cronet_header(hdr): |
| 29 |
return "cronet" in hdr |
| 30 |
def is_event_engine_header(hdr): |
| 31 |
return "/event_engine/" in hdr |
| 32 |
hdrs = set() |
| 33 |
pfx = 'include/' |
| 34 |
for lib in libs: |
| 35 |
if lib.language != 'c': continue |
| 36 |
for hdr in lib.get('public_headers', []): |
| 37 |
if is_platform_header(hdr): continue |
| 38 |
if is_cronet_header(hdr): continue |
| 39 |
if is_event_engine_header(hdr): continue |
| 40 |
assert(hdr[0:len(pfx)] == pfx) |
| 41 |
hdrs.add(hdr[len(pfx):]) |
| 42 |
hdrs = sorted(list(hdrs)) |
| 43 |
fns = list() |
| 44 |
for api in c_apis: |
| 45 |
if is_platform_header(api.header): |
| 46 |
continue |
| 47 |
fns.append(api.name) |
| 48 |
%>\ |
| 49 |
% for hdr in hdrs: |
| 50 |
#include <${hdr}> |
| 51 |
% endfor |
| 52 |
|
| 53 |
#include <stdio.h> |
| 54 |
|
| 55 |
int main(int argc, char **argv) { |
| 56 |
/* Use the parameters to avoid unused-parameter warning. |
| 57 |
(C89 parameters must be named.) */ |
| 58 |
(void)argc; |
| 59 |
(void)argv; |
| 60 |
|
| 61 |
% for fn in fns: |
| 62 |
printf("%lx", (unsigned long) ${fn}); |
| 63 |
% endfor |
| 64 |
return 0; |
| 65 |
} |