Commit 231f51a 1 parent 1b3c559 commit 231f51a Copy full SHA for 231f51a
File tree 4 files changed +24
-15
lines changed
4 files changed +24
-15
lines changed Original file line number Diff line number Diff line change 13
13
14
14
NS_ASSUME_NONNULL_BEGIN
15
15
16
- @implementation HGKeyboard
17
- @synthesize data=_data;
18
-
19
- + (void )initialize {
20
- if (self == [HGKeyboard class ]) {
16
+ __attribute__ ((constructor))
17
+ static void HangulInitialize() {
18
+ static bool initialized = 0 ;
19
+ if (!initialized) {
20
+ // Initialization code.
21
+ initialized = 1 ;
21
22
hangul_init ();
22
23
}
23
24
}
24
25
26
+ __attribute__ ((destructor))
27
+ static void HangulFinalize() {
28
+ hangul_fini ();
29
+ }
30
+
31
+ @implementation HGKeyboard
32
+ @synthesize data=_data;
33
+
25
34
// ! @ref hangul_keyboard_new
26
35
- (instancetype )init {
27
36
self = [self init ];
Original file line number Diff line number Diff line change 3
3
// Hangul
4
4
//
5
5
// Created by Jeong YunWon on 2018. 9. 26..
6
- // Copyright © 2018년 youknowone.org. All rights reserved.
6
+ // Copyright © 2018 youknowone.org. All rights reserved.
7
7
//
8
8
9
9
@import Foundation;
Original file line number Diff line number Diff line change 3
3
// Hangul
4
4
//
5
5
// Created by Jeong YunWon on 2018. 9. 26..
6
- // Copyright © 2018년 youknowone.org. All rights reserved.
6
+ // Copyright © 2018 youknowone.org. All rights reserved.
7
7
//
8
8
9
9
@import Foundation;
10
10
11
+ #import " Hangul/HGInputContext.h"
12
+
11
13
const char *libhangul_data_dir () {
12
- NSBundle *hangulBundle = [NSBundle mainBundle ];
14
+ NSBundle *hangulBundle = [NSBundle bundleForClass: [HGKeyboard class ] ];
13
15
NSString *path = hangulBundle.resourcePath ;
14
16
return path.fileSystemRepresentation ;
15
17
}
Original file line number Diff line number Diff line change 6
6
// Copyright © 2017 youknowone.org. All rights reserved.
7
7
//
8
8
9
- import XCTest
10
9
import Hangul
10
+ import XCTest
11
11
12
12
func ord( _ c: String ) -> Int32 {
13
13
return Int32 ( c. unicodeScalars. first!. value)
14
14
}
15
15
16
16
class HangulTests : XCTestCase {
17
-
18
17
override func setUp( ) {
19
18
super. setUp ( )
20
19
// Put setup code here. This method is called before the invocation of each test method in the class.
21
20
}
22
-
21
+
23
22
override func tearDown( ) {
24
23
// Put teardown code here. This method is called after the invocation of each test method in the class.
25
24
super. tearDown ( )
@@ -36,7 +35,7 @@ class HangulTests: XCTestCase {
36
35
}
37
36
38
37
func testKeyboard2( ) {
39
- hangul_init ( ) ;
38
+ hangul_init ( )
40
39
let hic = hangul_ic_new ( " 3gs " )
41
40
hangul_ic_process ( hic, ord ( " j " ) )
42
41
hangul_ic_process ( hic, ord ( " t " ) )
@@ -46,7 +45,7 @@ class HangulTests: XCTestCase {
46
45
}
47
46
48
47
func testBackspace( ) {
49
- hangul_init ( ) ;
48
+ hangul_init ( )
50
49
let hic = hangul_ic_new ( " 3gs " )
51
50
hangul_ic_process ( hic, ord ( " j " ) )
52
51
hangul_ic_process ( hic, ord ( " t " ) )
@@ -57,9 +56,8 @@ class HangulTests: XCTestCase {
57
56
58
57
func testPerformanceExample( ) {
59
58
// This is an example of a performance test case.
60
- self . measure {
59
+ measure {
61
60
// Put the code you want to measure the time of here.
62
61
}
63
62
}
64
-
65
63
}
You can’t perform that action at this time.
0 commit comments