File: swift_name.h

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (65 lines) | stat: -rw-r--r-- 2,151 bytes parent folder | download
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
#define SWIFT_NAME(X) __attribute__((swift_name(#X)))

#ifndef SWIFT_ENUM_EXTRA
#  define SWIFT_ENUM_EXTRA
#endif

#ifndef SWIFT_ENUM
#  define SWIFT_ENUM(_name)    \
  enum _name _name;            \
  enum __attribute__((enum_extensibility(open))) \
       __attribute__((external_source_symbol(language="Swift", \
                      defined_in="swift_name", generated_declaration))) \
       SWIFT_ENUM_EXTRA _name
#endif

// Renaming global variables.
int SNFoo SWIFT_NAME(Bar);

// Renaming tags and fields.
struct SWIFT_NAME(SomeStruct) SNSomeStruct {
  double X SWIFT_NAME(x);
};

// Renaming C functions
struct SNSomeStruct SNMakeSomeStruct(double X, double Y) SWIFT_NAME(makeSomeStruct(x:y:));

struct SNSomeStruct SNMakeSomeStructForX(double X) SWIFT_NAME(makeSomeStruct(x:));

// Renaming typedefs.
typedef int SNIntegerType SWIFT_NAME(MyInt);

// Renaming enumerations.
SWIFT_ENUM(SNColorChoice) {
  SNColorRed SWIFT_NAME(Rouge),
  SNColorGreen,
  SNColorBlue
};

// swift_private attribute
void SNTransposeInPlace(struct SNSomeStruct *value) __attribute__((swift_private));

typedef struct {
  double x, y, z;
} SNPoint SWIFT_NAME(Point);

// Importing a value into a member.
extern double DefaultXValue __attribute__((swift_name("SomeStruct.defaultX")));

// Importing a function as a method.
struct SNSomeStruct SNAdding(struct SNSomeStruct *value, double x) SWIFT_NAME(SomeStruct.adding(self:x:));

// Importing a function as an initializer.
struct SNSomeStruct SNCreate(double x) SWIFT_NAME(SomeStruct.init(theX:));

// Importing a function as a static property getter.
struct SNSomeStruct SNSomeStructGetDefault(void) SWIFT_NAME(getter:SomeStruct.defaultValue());

// Importing a function as a static property setter.
void SNSomeStructSetDefault(struct SNSomeStruct value) SWIFT_NAME(setter:SomeStruct.defaultValue(_:));

// Importing a function as an instance property getter.
double SNSomeStructGetFoo(struct SNSomeStruct s) SWIFT_NAME(getter:SomeStruct.foo(self:));

// Importing a function as an instance property setter.
void SNSomeStructSetFoo(struct SNSomeStruct s, double value) SWIFT_NAME(setter:SomeStruct.foo(self:_:));