This repository was archived by the owner on Apr 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate_program.go
More file actions
112 lines (91 loc) · 2.21 KB
/
template_program.go
File metadata and controls
112 lines (91 loc) · 2.21 KB
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
103
104
105
106
107
108
109
110
111
112
package main
const program_app_c = `#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello World\n");
return 0;
}
`
const program_app_cpp = `#include <iostream>
using std::cout;
using std::endl;
int main(int argc, char *argv[])
{
cout << "Hello World" << endl;
return 0;
}
`
const program_header = `#ifndef {{.Program}}_H
#define {{.Program}}_H
#define {{.Program}}_VERSION "0.1.0"
#define {{.Program}}_VERSION_MAJOR 0
#define {{.Program}}_VERSION_MINOR 1
#define {{.Program}}_VERSION_PATCH 0
#if _MSC_VER
#if defined({{.Program}}_IMPORT_SYMBOLS)
#define {{.Program}}_PUBLIC __declspec(dllimport)
#elif defined({{.Program}}_EXPORT_SYMBOLS)
#define {{.Program}}_PUBLIC __declspec(dllexport)
#else
#define {{.Program}}_PUBLIC
#endif
#elif __GNUC__ >= 4 || __clang__
#define {{.Program}}_PUBLIC __attribute__((__visibility__("default")))
#else
#define {{.Program}}_PUBLIC
#endif
#if __GNUC__ >= 4 || __clang__
#define {{.Program}}_PRIVATE __attribute__((__visibility__("hidden")))
#else
#define {{.Program}}_PRIVATE
#endif
#if _MSC_VER
#include <windows.h>
#else /* !_MSC_VER */
#ifdef __cplusplus
#ifndef _BOOL_IS_DEFINED
typedef bool BOOL;
#define FALSE false
#define TRUE true
#define _BOOL_IS_DEFINED
#endif /* BOOL */
#else
#if __STDC_VERSION__ < 199901L
#ifndef _BOOL_IS_DEFINED
typedef char BOOL;
#define FALSE 0
#define TRUE 1
#define _BOOL_IS_DEFINED
#endif /* BOOL */
#else
#ifndef _BOOL_IS_DEFINED
#include <stdbool.h>
typedef bool BOOL;
#define FALSE false
#define TRUE true
#define _BOOL_IS_DEFINED
#endif /* BOOL */
#endif /* C89 */
#endif /* __cplusplus */
#endif /* _MSC_VER */
#ifdef __cplusplus
extern "C" {
#endif
{{.Program}}_PUBLIC BOOL is_even(int n);
#ifdef __cplusplus
}
#endif
#endif /* {{.Program}}_H */
`
const program_lib_c = `#include "{{.Program}}.h"
BOOL is_even(int n)
{
return n % 2 == 0;
}
`
const program_lib_cpp = `#include "{{.Program}}.hpp"
BOOL is_even(int n)
{
return n % 2 == 0;
}
`